From f07a3b7cb3f50cf2cd9b5fb193abe5a823b74e2d Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Wed, 10 Jan 2018 15:45:14 +0100 Subject: [PATCH] print_value: Use sizeof(literal) instead of magic numbers --- cJSON.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cJSON.c b/cJSON.c index d20c676..1b08b3d 100644 --- a/cJSON.c +++ b/cJSON.c @@ -1277,7 +1277,7 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp switch ((item->type) & 0xFF) { case cJSON_NULL: - output = ensure(output_buffer, 5); + output = ensure(output_buffer, sizeof("null")); if (output == NULL) { return false; @@ -1286,7 +1286,7 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp return true; case cJSON_False: - output = ensure(output_buffer, 6); + output = ensure(output_buffer, sizeof("false")); if (output == NULL) { return false; @@ -1295,7 +1295,7 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp return true; case cJSON_True: - output = ensure(output_buffer, 5); + output = ensure(output_buffer, sizeof("true")); if (output == NULL) { return false;