diff --git a/src/dump.c b/src/dump.c index 2c7dee9..bbf87d0 100644 --- a/src/dump.c +++ b/src/dump.c @@ -38,7 +38,7 @@ static int dump_to_file(const char *buffer, size_t size, void *data) } /* 32 spaces (the maximum indentation size) */ -static char whitespace[] = " "; +static const char whitespace[] = " "; static int dump_indent(size_t flags, int depth, int space, json_dump_callback_t dump, void *data) { diff --git a/src/hashtable.c b/src/hashtable.c index 76cf69b..bcbaa8c 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -74,7 +74,7 @@ static void insert_to_bucket(hashtable_t *hashtable, bucket_t *bucket, } } -static size_t primes[] = { +static const size_t primes[] = { 5, 13, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, diff --git a/src/load.c b/src/load.c index d88a704..bf6ee30 100644 --- a/src/load.c +++ b/src/load.c @@ -37,7 +37,7 @@ #define l_isalpha(c) (l_isupper(c) || l_islower(c)) #define l_isdigit(c) ('0' <= (c) && (c) <= '9') #define l_isxdigit(c) \ - (l_isdigit(c) || 'A' <= (c) || (c) <= 'F' || 'a' <= (c) || (c) <= 'f') + (l_isdigit(c) || ('A' <= (c) && (c) <= 'F') || ('a' <= (c) && (c) <= 'f')) /* Read one byte from stream, convert to unsigned char, then int, and return. return EOF on end of file. This corresponds to the diff --git a/src/pack_unpack.c b/src/pack_unpack.c index 39db9b8..18f9ccb 100644 --- a/src/pack_unpack.c +++ b/src/pack_unpack.c @@ -21,7 +21,7 @@ typedef struct { int column; } scanner_t; -static const char *type_names[] = { +static const char * const type_names[] = { "object", "array", "string", @@ -34,7 +34,7 @@ static const char *type_names[] = { #define type_name(x) type_names[json_typeof(x)] -static const char *unpack_value_starters = "{[siIbfFOon"; +static const char unpack_value_starters[] = "{[siIbfFOon"; static void scanner_init(scanner_t *s, json_error_t *error,