Fix a declaration after statement

While at it, add -Wdeclaration-after-statement to AM_CFLAGS to catch
these in the future.
This commit is contained in:
Petri Lehtinen 2011-03-10 21:28:44 +02:00
parent 7f09f48e7e
commit 1111960120
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

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