Browse Source

coding guidelines: comply with MISRA Rule 15.2

- moved switch clause to avoid backward jump

Signed-off-by: Hess Nathan <nhess@baumer.com>
pull/72985/head
Hess Nathan 1 year ago committed by Henrik Brix Andersen
parent
commit
96fdbcab70
  1. 40
      lib/os/cbprintf_complete.c

40
lib/os/cbprintf_complete.c

@ -1601,6 +1601,26 @@ int z_cbvprintf_impl(cbprintf_cb out, void *ctx, const char *fp, @@ -1601,6 +1601,26 @@ int z_cbvprintf_impl(cbprintf_cb out, void *ctx, const char *fp,
break;
}
case 'p':
/* Implementation-defined: null is "(nil)", non-null
* has 0x prefix followed by significant address hex
* digits, no leading zeros.
*/
if (value->ptr != NULL) {
bps = encode_uint((uintptr_t)value->ptr, conv,
buf, bpe);
/* Use 0x prefix */
conv->altform_0c = true;
conv->specifier = 'x';
goto prec_int_pad0;
}
bps = "(nil)";
bpe = bps + 5;
break;
case 'c':
bps = buf;
buf[0] = CHAR_IS_SIGNED ? value->sint : value->uint;
@ -1653,26 +1673,6 @@ int z_cbvprintf_impl(cbprintf_cb out, void *ctx, const char *fp, @@ -1653,26 +1673,6 @@ int z_cbvprintf_impl(cbprintf_cb out, void *ctx, const char *fp,
}
}
break;
case 'p':
/* Implementation-defined: null is "(nil)", non-null
* has 0x prefix followed by significant address hex
* digits, no leading zeros.
*/
if (value->ptr != NULL) {
bps = encode_uint((uintptr_t)value->ptr, conv,
buf, bpe);
/* Use 0x prefix */
conv->altform_0c = true;
conv->specifier = 'x';
goto prec_int_pad0;
}
bps = "(nil)";
bpe = bps + 5;
break;
case 'n':
if (IS_ENABLED(CONFIG_CBPRINTF_N_SPECIFIER)) {

Loading…
Cancel
Save