diff options
author | Thomas Haller <thaller@redhat.com> | 2018-03-29 11:09:11 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-04-13 09:09:46 +0200 |
commit | efe5cf79c0eb61b86958f5cc58c7361121d0eede (patch) | |
tree | f0541a1e096ce955bfc3943c450e5722a12c9801 | |
parent | fdbf696f22894304e6f4313edaa57464cfdc5c95 (diff) | |
download | NetworkManager-efe5cf79c0eb61b86958f5cc58c7361121d0eede.tar.gz |
core: simplify NMActiveConnection.get_property to not create temporary GPtrArrray
Fixes: c050fb7cd2160f0b74ba8a0760e717e3fe329066
-rw-r--r-- | src/nm-active-connection.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index a24e946d31..33da0aa131 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -1172,7 +1172,7 @@ get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE ((NMActiveConnection *) object); - GPtrArray *devices; + char **strv; NMDevice *master_device = NULL; switch (prop_id) { @@ -1202,11 +1202,10 @@ get_property (GObject *object, guint prop_id, g_value_set_string (value, priv->specific_object ? priv->specific_object : "/"); break; case PROP_DEVICES: - devices = g_ptr_array_sized_new (2); + strv = g_new0 (char *, 2); if (priv->device && priv->state < NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) - g_ptr_array_add (devices, g_strdup (nm_dbus_object_get_path (NM_DBUS_OBJECT (priv->device)))); - g_ptr_array_add (devices, NULL); - g_value_take_boxed (value, (char **) g_ptr_array_free (devices, FALSE)); + strv[0] = g_strdup (nm_dbus_object_get_path (NM_DBUS_OBJECT (priv->device))); + g_value_take_boxed (value, strv); break; case PROP_STATE: if (priv->state_set) |