From f86bb0377fb942a71e4852e00a42e89e1af1eee1 Mon Sep 17 00:00:00 2001 From: Jacob Potter Date: Wed, 5 Dec 2012 16:46:14 -0800 Subject: [PATCH] Mark some constant data as const. Issue #95. --- src/dump.c | 2 +- src/hashtable.c | 2 +- src/pack_unpack.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) 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/pack_unpack.c b/src/pack_unpack.c index 39db9b8..cdce28c 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 * const unpack_value_starters = "{[siIbfFOon"; static void scanner_init(scanner_t *s, json_error_t *error,