summaryrefslogtreecommitdiff
path: root/libnm/nm-device.c
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-10-16 16:11:42 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-10-16 17:33:12 +0200
commit2f780dc1b579a561592481f7d775744f2566f5c8 (patch)
tree5c68337df137fdadfd3a7b0a36a5e08776a10398 /libnm/nm-device.c
parent1136de4221c8c7ce90a64bf5be8aaf01fcc93e4c (diff)
downloadNetworkManager-2f780dc1b579a561592481f7d775744f2566f5c8.tar.gz
libnm: define NMLldpNeighbor as boxed type
GLib introspection requires all types returned by public functions to be GObjects, basic types or boxed types in order to correctly manage resources. NMLldpNeighbor was a plain struct and GI complained with: Warning: NM: nm_lldp_neighbor_new: return value: Invalid non-constant return of bare structure or union; register as boxed type or (skip) To fix this define NMLldpNeighbor as a boxed type. Fixes: d3d2b494008322a4f1452cf873393ca85166022b
Diffstat (limited to 'libnm/nm-device.c')
-rw-r--r--libnm/nm-device.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/libnm/nm-device.c b/libnm/nm-device.c
index 18f669bf60..2c354f2728 100644
--- a/libnm/nm-device.c
+++ b/libnm/nm-device.c
@@ -60,6 +60,7 @@
static GType _nm_device_decide_type (GVariant *value);
gboolean connection_compatible (NMDevice *device, NMConnection *connection, GError **error);
+static NMLldpNeighbor *nm_lldp_neighbor_dup (NMLldpNeighbor *neighbor);
G_DEFINE_TYPE_WITH_CODE (NMDevice, nm_device, NM_TYPE_OBJECT,
_nm_object_register_type_func (g_define_type_id,
@@ -153,6 +154,8 @@ struct _NMLldpNeighbor {
GHashTable *attrs;
};
+G_DEFINE_BOXED_TYPE (NMLldpNeighbor, nm_lldp_neighbor, nm_lldp_neighbor_dup, nm_lldp_neighbor_unref)
+
static void
nm_device_init (NMDevice *device)
{
@@ -2440,7 +2443,7 @@ nm_device_get_setting_type (NMDevice *device)
}
/**
- * nm_lldp_neighbor_new
+ * nm_lldp_neighbor_new:
*
* Creates a new #NMLldpNeighbor object.
*
@@ -2461,8 +2464,19 @@ nm_lldp_neighbor_new (void)
return neigh;
}
+static NMLldpNeighbor *
+nm_lldp_neighbor_dup (NMLldpNeighbor *neighbor)
+{
+ NMLldpNeighbor *copy;
+
+ copy = nm_lldp_neighbor_new ();
+ copy->attrs = g_hash_table_ref (neighbor->attrs);
+
+ return copy;
+}
+
/**
- * nm_lldp_neighbor_ref
+ * nm_lldp_neighbor_ref:
* @neighbor: the #NMLldpNeighbor
*
* Increases the reference count of the object.