From c08c805ecd8f2000a35cdeae7b16244d0b3c0528 Mon Sep 17 00:00:00 2001 From: Björn Esser Date: Thu, 14 Dec 2017 01:30:54 +0100 Subject: Adaptions for API change in json-c v0.13 Lift restriction on json-c <= 0.12.1 ipc-server: Acquire ownership of referenced json_object properly When adding a referenced json_object with an unknown lifetime to another json_object, it must be done with a wrapped call to json_object_get() to acquire the ownership of that json_object. --- swaybar/status_line.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'swaybar') diff --git a/swaybar/status_line.c b/swaybar/status_line.c index 87e90caf..e3cc0bf4 100644 --- a/swaybar/status_line.c +++ b/swaybar/status_line.c @@ -2,8 +2,8 @@ #include #include #include -#include +#include "sway_json_helper.h" #include "swaybar/config.h" #include "swaybar/status_line.h" #include "log.h" @@ -70,8 +70,7 @@ static void parse_json(struct bar *bar, const char *text) { bar->status->block_line = create_list(); - int i; - for (i = 0; i < json_object_array_length(results); ++i) { + for (json_ar_len_t i = 0; i < json_object_array_length(results); ++i) { json_object *full_text, *short_text, *color, *min_width, *align, *urgent; json_object *name, *instance, *separator, *separator_block_width; json_object *background, *border, *border_top, *border_bottom; -- cgit v1.2.3-70-g09d2