diff options
| author | Michael Biebl <biebl@debian.org> | 2017-12-12 15:53:47 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2017-12-12 15:53:47 +0100 |
| commit | 743faa81fda27a9c03298e8d6074623dc30db606 (patch) | |
| tree | 28418e92b22530bb05f043084626291ed1e3d46b /shared/nm-utils/nm-shared-utils.c | |
| parent | 8dda18a856c2a05cefcab6278469c9d8df30f935 (diff) | |
| parent | afcd268ea7b1149fbfb66bce4eca659b675da0a2 (diff) | |
Update upstream source from tag 'upstream/1.10.2'
Update to upstream version '1.10.2' with Debian dir 41691ea145b392588cd4e9e7496b61d5a95965fb
Diffstat (limited to 'shared/nm-utils/nm-shared-utils.c')
| -rw-r--r-- | shared/nm-utils/nm-shared-utils.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/shared/nm-utils/nm-shared-utils.c b/shared/nm-utils/nm-shared-utils.c index cea60edf..0b343afd 100644 --- a/shared/nm-utils/nm-shared-utils.c +++ b/shared/nm-utils/nm-shared-utils.c @@ -151,7 +151,7 @@ nm_strquote (char *buf, gsize buf_len, const char *str) switch (buf_len) { case 2: *(buf++) = '^'; - /* fall-through*/ + /* fall-through */ case 1: *(buf++) = '\0'; break; @@ -569,7 +569,7 @@ nm_utils_strsplit_set (const char *str, const char *delimiters) /* reallocate the buffer. Note that for now the string * continues to be in ptr0/s0. We fix that at the end. */ - alloc_size += 2; + alloc_size *= 2; ptr = g_malloc ((sizeof (const char *) * (alloc_size + 1)) + str_len); memcpy (ptr, ptr_old, sizeof (const char *) * plen); if (ptr_old != ptr0) @@ -845,6 +845,32 @@ nm_g_object_set_property (GObject *object, return TRUE; } +gboolean +nm_g_object_set_property_boolean (GObject *object, + const gchar *property_name, + gboolean value, + GError **error) +{ + nm_auto_unset_gvalue GValue gvalue = { 0 }; + + g_value_init (&gvalue, G_TYPE_BOOLEAN); + g_value_set_boolean (&gvalue, !!value); + return nm_g_object_set_property (object, property_name, &gvalue, error); +} + +gboolean +nm_g_object_set_property_uint (GObject *object, + const gchar *property_name, + guint value, + GError **error) +{ + nm_auto_unset_gvalue GValue gvalue = { 0 }; + + g_value_init (&gvalue, G_TYPE_UINT); + g_value_set_uint (&gvalue, value); + return nm_g_object_set_property (object, property_name, &gvalue, error); +} + GParamSpec * nm_g_object_class_find_property_from_gtype (GType gtype, const char *property_name) |