aboutsummaryrefslogtreecommitdiff
path: root/test/bin/json_process.c
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2014-02-11 14:49:15 +0200
committerPetri Lehtinen <petri@digip.org>2014-02-11 14:49:15 +0200
commit17ec22f514ceb9277bea1e38cc8ea69eec1edd53 (patch)
tree55b75defa871dc7178a0f2c6cead32b2bd69b8f5 /test/bin/json_process.c
parenta721d36f4143faa94c78e447515994891ce9c30f (diff)
parente83ded066a610f8de7caaa3942769321ededa84f (diff)
downloadjansson-17ec22f514ceb9277bea1e38cc8ea69eec1edd53.zip
jansson-17ec22f514ceb9277bea1e38cc8ea69eec1edd53.tar.gz
jansson-17ec22f514ceb9277bea1e38cc8ea69eec1edd53.tar.bz2
Merge branch '2.6'
Diffstat (limited to 'test/bin/json_process.c')
-rw-r--r--test/bin/json_process.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/bin/json_process.c b/test/bin/json_process.c
index 0799aa8..724648c 100644
--- a/test/bin/json_process.c
+++ b/test/bin/json_process.c
@@ -37,6 +37,8 @@ struct config {
int sort_keys;
int strip;
int use_env;
+ int have_hashseed;
+ int hashseed;
} conf;
#define l_isspace(c) ((c) == ' ' || (c) == '\n' || (c) == '\r' || (c) == '\t')
@@ -108,6 +110,12 @@ static void read_conf(FILE *conffile)
conf.sort_keys = atoi(val);
if (!strcmp(line, "STRIP"))
conf.strip = atoi(val);
+ if (!strcmp(line, "HASHSEED")) {
+ conf.have_hashseed = 1;
+ conf.hashseed = atoi(val);
+ } else {
+ conf.have_hashseed = 0;
+ }
}
free(buffer);
@@ -188,6 +196,9 @@ int use_conf(char *test_path)
if (conf.sort_keys)
flags |= JSON_SORT_KEYS;
+ if (conf.have_hashseed)
+ json_object_seed(conf.hashseed);
+
if (conf.strip) {
/* Load to memory, strip leading and trailing whitespace */
buffer = loadfile(infile);
@@ -265,7 +276,10 @@ int use_env()
flags |= JSON_PRESERVE_ORDER;
if(getenv_int("JSON_SORT_KEYS"))
- flags |= JSON_SORT_KEYS;
+ flags |= JSON_SORT_KEYS;
+
+ if(getenv("HASHSEED"))
+ json_object_seed(getenv_int("HASHSEED"));
if(getenv_int("STRIP")) {
/* Load to memory, strip leading and trailing whitespace */