mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 20:30:35 +01:00
all: update compatiblity for older libjansson versions
- nm-ovsdb.c uses json_load_callback(), which is jansson v2.4. Hence, it cannot build the OVS plugin in our Travis-CI, which is still on Ubuntu Precise. Disable building the plugin in travis and add a compiler warning when building against an older version. - since jansson v2.3, there is json_object_key_to_iter() to implement the for-each macros. Use it in json_object_foreach_safe() when available.
This commit is contained in:
parent
650a47e16c
commit
595aaf0f3e
3 changed files with 20 additions and 7 deletions
|
|
@ -26,7 +26,7 @@ addons:
|
|||
coverity_scan:
|
||||
project:
|
||||
name: NetworkManager/NetworkManager
|
||||
build_command_prepend: sh autogen.sh --with-systemd-logind=no --enable-more-warnings=no
|
||||
build_command_prepend: sh autogen.sh --with-systemd-logind=no --enable-more-warnings=no --disable-ovs
|
||||
build_command: make -j4
|
||||
branch_pattern: .*coverity.*
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
#ifndef json_object_foreach
|
||||
#define json_object_foreach(object, key, value) \
|
||||
for(key = json_object_iter_key(json_object_iter(object)); \
|
||||
key && (value = json_object_iter_value(json_object_key_to_iter(key))); \
|
||||
key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key))))
|
||||
key && (value = json_object_iter_value(json_object_iter_at (object, key) )); \
|
||||
key = json_object_iter_key(json_object_iter_next(object, json_object_iter_at (object, key))))
|
||||
#endif
|
||||
|
||||
/* Added in Jansson v2.4 (released Sep 23 2012), but travis.ci has v2.2. */
|
||||
|
|
@ -42,19 +42,28 @@
|
|||
/* Added in Jansson v2.5 (released Sep 19 2013), but travis.ci has v2.2. */
|
||||
#ifndef json_array_foreach
|
||||
#define json_array_foreach(array, index, value) \
|
||||
for (index = 0; \
|
||||
index < json_array_size(array) && (value = json_array_get(array, index)); \
|
||||
index++)
|
||||
for(index = 0; \
|
||||
index < json_array_size(array) && (value = json_array_get(array, index)); \
|
||||
index++)
|
||||
#endif
|
||||
|
||||
/* Added in Jansson v2.8 */
|
||||
#ifndef json_object_foreach_safe
|
||||
#define json_object_foreach_safe(object, n, key, value) \
|
||||
#if JANSSON_VERSION_HEX < 0x020300
|
||||
#define json_object_foreach_safe(object, n, key, value) \
|
||||
for (key = json_object_iter_key (json_object_iter (object)), \
|
||||
n = json_object_iter_next (object, json_object_iter_at (object, key)); \
|
||||
key && (value = json_object_iter_value (json_object_iter_at (object, key))); \
|
||||
key = json_object_iter_key (n), \
|
||||
n = json_object_iter_next (object, json_object_iter_at (object, key)))
|
||||
#else
|
||||
#define json_object_foreach_safe(object, n, key, value) \
|
||||
for(key = json_object_iter_key(json_object_iter(object)), \
|
||||
n = json_object_iter_next(object, json_object_key_to_iter(key)); \
|
||||
key && (value = json_object_iter_value(json_object_key_to_iter(key))); \
|
||||
key = json_object_iter_key(n), \
|
||||
n = json_object_iter_next(object, json_object_key_to_iter(key)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* WITH_JANSON */
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#if JANSSON_VERSION_HEX < 0x020400
|
||||
#warning "requires at least libjansson 2.4"
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *connection_uuid;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue