Browse Source

API: json_object_foreach doesn't exist in Jansson 1.1, so use the json_object_iter family instead

Luke Dashjr 14 years ago
parent
commit
e9cfe5f966
1 changed files with 5 additions and 1 deletions
  1. 5 1
      api.c

+ 5 - 1
api.c

@@ -800,8 +800,12 @@ append_kv(char *buf, json_t*info, bool isjson)
 	json_t *value;
 	json_t *value;
 	const char *key, *tmpl = isjson ? ",\"%s\":%s" : ",%s=%s";
 	const char *key, *tmpl = isjson ? ",\"%s\":%s" : ",%s=%s";
 	char *vdump;
 	char *vdump;
+	void *it;
+
+	for (it = json_object_iter(info); it; it = json_object_iter_next(info, it)) {
+		key = json_object_iter_key(it);
+		value = json_object_iter_value(it);
 
 
-	json_object_foreach(info, key, value) {
 		if (isjson || !json_is_string(value))
 		if (isjson || !json_is_string(value))
 			vdump = json_dumps(value, JSON_COMPACT | JSON_ENCODE_ANY);
 			vdump = json_dumps(value, JSON_COMPACT | JSON_ENCODE_ANY);
 		else
 		else