diff --git a/src/Makefile.am b/src/Makefile.am index ec9b099..4f2a58d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,5 +21,5 @@ libjansson_la_LDFLAGS = \ if GCC # These flags are gcc specific -AM_CFLAGS = -Wall -Wextra -Werror +AM_CFLAGS = -Wall -Wextra -Wdeclaration-after-statement -Werror endif diff --git a/src/error.c b/src/error.c index 074a68e..a7c8cbb 100644 --- a/src/error.c +++ b/src/error.c @@ -18,10 +18,12 @@ void jsonp_error_init(json_error_t *error, const char *source) void jsonp_error_set_source(json_error_t *error, const char *source) { + size_t length; + if(!error || !source) return; - size_t length = strlen(source); + length = strlen(source); if(length < JSON_ERROR_SOURCE_LENGTH) strcpy(error->source, source); else {