Skip to content

Commit 254dfd4

Browse files
jenmwmsnashif
authored andcommitted
lib: os: add final else where missing in cbprintf_*
cbprintf_* had several places missing final elsestatement in the if else if construct. This commit adds else {} to comply with coding guideline 15.7. Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
1 parent b504f8b commit 254dfd4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/os/cbprintf_complete.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,8 @@ static inline const char *extract_specifier(struct conversion *conv,
557557
default:
558558
break;
559559
}
560+
} else {
561+
;
560562
}
561563
break;
562564

@@ -586,6 +588,8 @@ static inline const char *extract_specifier(struct conversion *conv,
586588
} else if ((conv->length_mod != LENGTH_NONE)
587589
&& (conv->length_mod != LENGTH_UPPER_L)) {
588590
conv->invalid = true;
591+
} else {
592+
;
589593
}
590594

591595
break;
@@ -802,6 +806,8 @@ static char *encode_uint(uint_value_type value,
802806
conv->altform_0 = true;
803807
} else if (radix == 16) {
804808
conv->altform_0c = true;
809+
} else {
810+
;
805811
}
806812
}
807813

@@ -878,6 +884,8 @@ static char *encode_float(double value,
878884
*sign = '+';
879885
} else if (conv->flag_space) {
880886
*sign = ' ';
887+
} else {
888+
;
881889
}
882890

883891
/* Extract the non-negative offset exponent and fraction. Record
@@ -1392,6 +1400,8 @@ int cbvprintf(cbprintf_cb out, void *ctx, const char *fp, va_list ap)
13921400
}
13931401
} else if (conv->width_present) {
13941402
width = conv->width_value;
1403+
} else {
1404+
;
13951405
}
13961406

13971407
/* If dynamic precision is specified, process it, otherwise
@@ -1408,6 +1418,8 @@ int cbvprintf(cbprintf_cb out, void *ctx, const char *fp, va_list ap)
14081418
}
14091419
} else if (conv->prec_present) {
14101420
precision = conv->prec_value;
1421+
} else {
1422+
;
14111423
}
14121424

14131425
/* Reuse width and precision memory in conv for value

lib/os/cbprintf_nano.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ int cbvprintf(cbprintf_cb out, void *ctx, const char *fmt, va_list ap)
204204
} else if (special == '+') {
205205
prefix = "+";
206206
min_width--;
207+
} else {
208+
;
207209
}
208210
data_len = convert_value(d, 10, 0, buf + sizeof(buf));
209211
data = buf + sizeof(buf) - data_len;

0 commit comments

Comments
 (0)