summaryrefslogtreecommitdiffhomepage
path: root/lib.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-10 12:11:35 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-10 15:08:54 +0200
commit439136c15a5d0b5a95f49dab7c8e7513315839c4 (patch)
tree8150220db173e46b07cb749f4a8d52ed7ea7c18a /lib.c
parent4631259c83351bb99bfde85fef9cfa6ab233f069 (diff)
build: test whether json_object_array_shrink() is available
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index e1aea9a..f102505 100644
--- a/lib.c
+++ b/lib.c
@@ -437,7 +437,9 @@ ut_pop(struct ut_state *s, uint32_t off, struct json_object *args)
if (arrlen > 0) {
item = json_object_array_get_idx(arr, arrlen - 1);
json_object_array_del_idx(arr, arrlen - 1, 1);
+#ifdef HAVE_ARRAY_SHRINK
json_object_array_shrink(arr, 0);
+#endif
}
return json_object_get(item);
@@ -461,7 +463,9 @@ ut_shift(struct ut_state *s, uint32_t off, struct json_object *args)
json_object_array_get_idx(arr, arridx + 1));
json_object_array_del_idx(arr, arrlen - 1, 1);
+#ifdef HAVE_ARRAY_SHRINK
json_object_array_shrink(arr, 0);
+#endif
return item;
}