gluon-mesh-babel: respondd: support libjson-c-0.12 and libjson-c-0.13
This can be reverted after updating the package feed to something newer than 080ba31eec2ff4c165ce5a1bb9d434ddd91bdb6b from 2019-04-30 and should be in the upcoming openwrt release after 19.07
This commit is contained in:
parent
1db3c8b40b
commit
d061c97933
@ -841,11 +841,20 @@ static struct json_object * respondd_provider_neighbours(void) {
|
||||
|
||||
if (neighbours) {
|
||||
pthread_rwlock_rdlock(&neighbours_lock);
|
||||
int deepcopy_state = json_object_deep_copy(neighbours, neighbours_copy, NULL);
|
||||
#if (JSON_C_MINOR_VERSION >= 13)
|
||||
int deepcopy_state = json_object_deep_copy(neighbours, &neighbours_copy, NULL);
|
||||
#else
|
||||
char *serialized_neighbours = json_object_to_json_string(neighbours);
|
||||
#endif
|
||||
pthread_rwlock_unlock(&neighbours_lock);
|
||||
|
||||
#if (JSON_C_MINOR_VERSION >= 13)
|
||||
if (!deepcopy_state)
|
||||
json_object_object_add(ret, "babel", neighbours_copy);
|
||||
#else
|
||||
if (serialized_neighbours)
|
||||
json_object_object_add(ret, "babel", json_tokener_parse(serialized_neighbours));
|
||||
#endif
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user