diff options
| author | Michael Biebl <biebl@debian.org> | 2018-05-11 22:08:45 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-05-11 22:08:45 +0200 |
| commit | ee9c73a923909e23a649407be77e25235d769e25 (patch) | |
| tree | e21c923621fa278e737da693df9eb60ea31a6067 /src/devices/ovs/nm-ovsdb.c | |
| parent | f60117b41d5433be1b4a96d82cd11d0c3dce9b63 (diff) | |
New upstream version 1.10.8 upstream/1.10.8
Diffstat (limited to 'src/devices/ovs/nm-ovsdb.c')
| -rw-r--r-- | src/devices/ovs/nm-ovsdb.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c index b8f5a935..92fcfa01 100644 --- a/src/devices/ovs/nm-ovsdb.c +++ b/src/devices/ovs/nm-ovsdb.c @@ -22,20 +22,37 @@ #include "nm-ovsdb.h" #include <string.h> +#include <jansson.h> #include <gmodule.h> #include <gio/gunixsocketaddress.h> -#include "nm-utils/nm-jansson.h" #include "devices/nm-device.h" #include "platform/nm-platform.h" #include "nm-core-internal.h" -/*****************************************************************************/ +/* Added in Jansson v2.4 (released Sep 23 2012), but travis.ci has v2.2. */ +#ifndef json_boolean +#define json_boolean(val) ((val) ? json_true() : json_false()) +#endif + +/* 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++) +#endif -#if JANSSON_VERSION_HEX < 0x020400 -#warning "requires at least libjansson 2.4" +/* Added in Jansson v2.3 (released Jan 27 2012) */ +#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)))) #endif +/*****************************************************************************/ + typedef struct { char *name; char *connection_uuid; @@ -78,7 +95,7 @@ typedef struct { GHashTable *interfaces; /* interface uuid => OpenvswitchInterface */ GHashTable *ports; /* port uuid => OpenvswitchPort */ GHashTable *bridges; /* bridge uuid => OpenvswitchBridge */ - char *db_uuid; + const char *db_uuid; } NMOvsdbPrivate; struct _NMOvsdb { @@ -127,7 +144,7 @@ typedef struct { OvsdbMethodCallback callback; gpointer user_data; union { - char *ifname; + const char *ifname; struct { NMConnection *bridge; NMConnection *port; @@ -867,7 +884,7 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg) if (ovs) { iter = json_object_iter (ovs); - priv->db_uuid = iter ? g_strdup (json_object_iter_key (iter)) : NULL; + priv->db_uuid = g_strdup (iter ? json_object_iter_key (iter) : NULL); } /* Interfaces */ |