From 01cf818e48296012f408f9c2f076a2a37c049344 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 24 Feb 2019 19:32:14 +0100 Subject: [PATCH] remove a warning --- client/jansson/error.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/client/jansson/error.c b/client/jansson/error.c index b94b3a3a1..96b3b3fac 100644 --- a/client/jansson/error.c +++ b/client/jansson/error.c @@ -3,8 +3,7 @@ void jsonp_error_init(json_error_t *error, const char *source) { - if(error) - { + if (error) { error->text[0] = '\0'; error->line = -1; error->column = -1; @@ -20,13 +19,13 @@ void jsonp_error_set_source(json_error_t *error, const char *source) { size_t length; - if(!error || !source) + if (!error || !source) return; length = strlen(source); - if(length < JSON_ERROR_SOURCE_LENGTH) - strncpy(error->source, source, JSON_ERROR_SOURCE_LENGTH); - else { + if (length < JSON_ERROR_SOURCE_LENGTH) { + strncpy(error->source, source, length); + } else { size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4; memcpy(error->source, "...", 3); strncpy(error->source + 3, source + extra, length - extra + 1); @@ -38,7 +37,6 @@ void jsonp_error_set(json_error_t *error, int line, int column, const char *msg, ...) { va_list ap; - va_start(ap, msg); jsonp_error_vset(error, line, column, position, code, msg, ap); va_end(ap); @@ -48,10 +46,10 @@ void jsonp_error_vset(json_error_t *error, int line, int column, size_t position, enum json_error_code code, const char *msg, va_list ap) { - if(!error) + if (!error) return; - if(error->text[0] != '\0') { + if (error->text[0] != '\0') { /* error already set */ return; }