From e1f4fac9a27b3edfae035584fbcc0c5f4daa3d46 Mon Sep 17 00:00:00 2001 From: "Thomas H.P. Andersen" Date: Tue, 29 Sep 2020 01:14:19 +0200 Subject: [PATCH] ratbagd-json: fix compilation with clang Compilation on clang failed as we would try to jump to the 'out' label and then jump over the initialization of a variable with __attribute__((cleanup)). We move the initaliztion up to make sure it happens before the goto. --- ratbagd/ratbagd-json.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ratbagd/ratbagd-json.c b/ratbagd/ratbagd-json.c index 54a3ae2a..bfa1fd1d 100644 --- a/ratbagd/ratbagd-json.c +++ b/ratbagd/ratbagd-json.c @@ -515,6 +515,7 @@ int ratbagd_parse_json(const char *data, struct ratbag_test_device *device) JsonArray *arr; int r = -EINVAL; g_autoptr(GError) error = NULL; + g_autoptr(GList) list = NULL; error = 0; parser = json_parser_new(); @@ -540,7 +541,7 @@ int ratbagd_parse_json(const char *data, struct ratbag_test_device *device) num_buttons = device->num_buttons; num_leds = device->num_leds; - g_autoptr(GList) list = json_array_get_elements(arr); + list = json_array_get_elements(arr); GList *l = list; int idx = 0; while (l != NULL) {