From: Florian Forster Date: Wed, 17 May 2017 06:17:38 +0000 (+0200) Subject: curl_json plugin: Work around a limitation in EPEL6's GCC. X-Git-Tag: collectd-5.8.0~168^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=17e1d8131433d5c737a568c9e85df735c6bcd7b0;p=collectd.git curl_json plugin: Work around a limitation in EPEL6's GCC. --- diff --git a/src/curl_json.c b/src/curl_json.c index 6b50b454..181f18bb 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -946,9 +946,13 @@ static int cj_read(user_data_t *ud) /* {{{ */ db->depth = 0; memset(&db->state, 0, sizeof(db->state)); - db->state[0].entry = &(cj_tree_entry_t){ - .type = TREE, .tree = db->tree, - }; + + /* This is not a compound literal because EPEL6's GCC is not cool enough to + * handle anonymous unions within compound literals. */ + cj_tree_entry_t root = {0}; + root.type = TREE; + root.tree = db->tree; + db->state[0].entry = &root; int status = cj_perform(db); diff --git a/src/curl_json_test.c b/src/curl_json_test.c index 4b984660..e8f8f6bb 100644 --- a/src/curl_json_test.c +++ b/src/curl_json_test.c @@ -52,9 +52,10 @@ static cj_t *test_setup(char *json, char *key_path) { assert(cj_append_key(db, key) == 0); - db->state[0].entry = &(cj_tree_entry_t){ - .type = TREE, .tree = db->tree, - }; + cj_tree_entry_t root = {0}; + root.type = TREE; + root.tree = db->tree; + db->state[0].entry = &root; cj_curl_callback(json, strlen(json), 1, db); #if HAVE_YAJL_V2