From c366c155f183b3d980206cd25ad548e9f01c14b5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 1 Sep 2018 19:18:51 +0200 Subject: [PATCH] shared: rename PROP_0 in NM_GOBJECT_PROPERTIES_DEFINE() and skip it in nm_gobject_notify_together() PROP_0 is how we commonly name this property when we don't use NM_GOBJECT_PROPERTIES_DEFINE(). Rename it. Also, allow to skip PROP_0 in nm_gobject_notify_together(), that is handy to optionally invoke a notification, like nm_gobject_notify_together (obj, PROP_SOMETHING, changed ? PROP_OTHER : PROP_0); --- shared/nm-utils/nm-macros-internal.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h index 6937994c38..084219b4bb 100644 --- a/shared/nm-utils/nm-macros-internal.h +++ b/shared/nm-utils/nm-macros-internal.h @@ -900,7 +900,7 @@ nm_str_realloc (char *str) #define NM_GOBJECT_PROPERTIES_DEFINE_BASE(...) \ typedef enum { \ - _PROPERTY_ENUMS_0, \ + PROP_0, \ __VA_ARGS__ \ _PROPERTY_ENUMS_LAST, \ } _PropertyEnums; \ @@ -921,8 +921,11 @@ _nm_gobject_notify_together_impl (obj_type *obj, guint n, const _PropertyEnums * while (n-- > 0) { \ const _PropertyEnums prop = *props++; \ \ - nm_assert ((gsize) prop < G_N_ELEMENTS (obj_properties)); \ - g_object_notify_by_pspec ((GObject *) obj, obj_properties[prop]); \ + if (prop != PROP_0) { \ + nm_assert ((gsize) prop < G_N_ELEMENTS (obj_properties)); \ + nm_assert (obj_properties[prop]); \ + g_object_notify_by_pspec ((GObject *) obj, obj_properties[prop]); \ + } \ } \ if (freeze_thaw) \ g_object_thaw_notify ((GObject *) obj); \