1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-09-04 22:30:54 +00:00

Fix traivis ci, which has an older version of libjansson.

This commit is contained in:
Shuai Lin
2016-06-28 14:18:51 +08:00
parent 906082601d
commit de84634c66
2 changed files with 10 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ inline static const json_t *json_array_get_json_or_null_element (json_t *array,
inline static void json_array_add_json_or_null_element (json_t *array, const json_t *value) inline static void json_array_add_json_or_null_element (json_t *array, const json_t *value)
{ {
if (value) { if (value) {
json_t *obj = json_deep_copy(value); json_t *obj = json_deep_copy((json_t*)value);
json_array_append_new (array, obj); json_array_append_new (array, obj);
} else { } else {
json_array_append_new (array, json_null ()); json_array_append_new (array, json_null ());

View File

@@ -336,6 +336,15 @@ test_searpc__json_return_type (void)
json_decref(result); json_decref(result);
} }
// The macro `json_object_foreach` is not defined in older versions of
// libjansson.
#ifndef json_object_foreach
#define json_object_foreach(object, key, value) \
for(key = json_object_iter_key(json_object_iter(object)); \
key && (value = json_object_iter_value(json_object_key_to_iter(key))); \
key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key))))
#endif
json_t * json_t *
count_json_kvs (const json_t *obj, GError **error) count_json_kvs (const json_t *obj, GError **error)
{ {