Commit ac487cf5 authored by Abramo Bagnara's avatar Abramo Bagnara Committed by Anas Nashif
Browse files

coding guidelines: comply with MISRA C:2012 Rule 15.2



In particular:

- moved switch clause so to avoid backward jump

Signed-off-by: default avatarAbramo Bagnara <abramo.bagnara@bugseng.com>
parent 08619905
Loading
Loading
Loading
Loading
+20 −20
Original line number Diff line number Diff line
@@ -1617,6 +1617,26 @@ int cbvprintf(cbprintf_cb out, void *ctx, const char *fp, va_list ap)

			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 ? (char)value->sint : (char)value->uint);
@@ -1669,26 +1689,6 @@ int cbvprintf(cbprintf_cb out, void *ctx, const char *fp, va_list ap)
				}
			}

			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)) {