From 17e1d8131433d5c737a568c9e85df735c6bcd7b0 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 17 May 2017 08:17:38 +0200 Subject: [PATCH] curl_json plugin: Work around a limitation in EPEL6's GCC. --- src/curl_json.c | 10 +++++++--- src/curl_json_test.c | 7 ++++--- 2 files changed, 11 insertions(+), 6 deletions(-) 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 -- 2.30.2