From de2de5e2fd154db9af27504e6f59a6483bd2d937 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 10 Jul 2020 19:34:07 -0500 Subject: [PATCH] yajl: Clean up the formatting of some C macros --- modules/libcom/src/yajl/yajl_gen.c | 31 +++++++++++++++--------------- modules/libcom/src/yajl/yajl_lex.c | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/modules/libcom/src/yajl/yajl_gen.c b/modules/libcom/src/yajl/yajl_gen.c index 7d86ec8c7..05183e247 100644 --- a/modules/libcom/src/yajl/yajl_gen.c +++ b/modules/libcom/src/yajl/yajl_gen.c @@ -134,17 +134,17 @@ yajl_gen_free(yajl_gen g) } #define INSERT_SEP \ - if (g->state[g->depth] == yajl_gen_map_key || \ - g->state[g->depth] == yajl_gen_in_array) { \ - g->print(g->ctx, ",", 1); \ - if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); \ - } else if (g->state[g->depth] == yajl_gen_map_val) { \ - g->print(g->ctx, ":", 1); \ - if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, " ", 1); \ - } + if (g->state[g->depth] == yajl_gen_map_key || \ + g->state[g->depth] == yajl_gen_in_array) { \ + g->print(g->ctx, ",", 1); \ + if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); \ + } else if (g->state[g->depth] == yajl_gen_map_val) { \ + g->print(g->ctx, ":", 1); \ + if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, " ", 1); \ + } -#define INSERT_WHITESPACE \ - if ((g->flags & yajl_gen_beautify)) { \ +#define INSERT_WHITESPACE \ + if ((g->flags & yajl_gen_beautify)) { \ if (g->state[g->depth] != yajl_gen_map_val) { \ unsigned int _i; \ for (_i=0;_idepth;_i++) \ @@ -163,8 +163,8 @@ yajl_gen_free(yajl_gen g) /* check that we're not complete, or in error state. in a valid state * to be generating */ #define ENSURE_VALID_STATE \ - if (g->state[g->depth] == yajl_gen_error) { \ - return yajl_gen_in_error_state;\ + if (g->state[g->depth] == yajl_gen_error) { \ + return yajl_gen_in_error_state; \ } else if (g->state[g->depth] == yajl_gen_complete) { \ return yajl_gen_generation_complete; \ } @@ -194,8 +194,9 @@ yajl_gen_free(yajl_gen g) break; \ } \ -#define FINAL_NEWLINE \ - if ((g->flags & yajl_gen_beautify) && g->state[g->depth] == yajl_gen_complete) \ +#define FINAL_NEWLINE \ + if ((g->flags & yajl_gen_beautify) && \ + g->state[g->depth] == yajl_gen_complete) \ g->print(g->ctx, "\n", 1); yajl_gen_status @@ -224,7 +225,7 @@ yajl_gen_double(yajl_gen g, double number) } else { special = 0; - sprintf(i, "%.20g", number); + sprintf(i, "%.17g", number); if (strspn(i, "0123456789-") == strlen(i)) { strcat(i, ".0"); } diff --git a/modules/libcom/src/yajl/yajl_lex.c b/modules/libcom/src/yajl/yajl_lex.c index e59ce5488..8dbff43da 100644 --- a/modules/libcom/src/yajl/yajl_lex.c +++ b/modules/libcom/src/yajl/yajl_lex.c @@ -200,7 +200,7 @@ static const char charLookupTable[256] = * * NOTE: on error the offset will point to the first char of the * invalid utf8 */ -#define UTF8_CHECK_EOF if (*offset >= jsonTextLen) { return yajl_tok_eof; } +#define UTF8_CHECK_EOF if (*offset >= jsonTextLen) return yajl_tok_eof; static yajl_tok yajl_lex_utf8_char(yajl_lexer lexer, const unsigned char * jsonText,