gobject: Use local variable names in macros less likely to clash

At least GDBus had code that had "_object" as a parameter to one of
its functions, but this clashes with the GObject macro
G_OBJECT_WARN_INVALID_PROPERTY_ID() which created a local "_object".

Since many of us cargo cult around copies of objects, let's be
defensive here and use local variable names less likely to clash with
application code.

https://bugzilla.gnome.org/show_bug.cgi?id=689377
This commit is contained in:
Colin Walters 2012-11-30 15:22:54 -05:00
parent e97a2f4195
commit 33de093b5a

View File

@ -567,16 +567,16 @@ gsize g_object_compat_control (gsize what,
/* --- implementation macros --- */ /* --- implementation macros --- */
#define G_OBJECT_WARN_INVALID_PSPEC(object, pname, property_id, pspec) \ #define G_OBJECT_WARN_INVALID_PSPEC(object, pname, property_id, pspec) \
G_STMT_START { \ G_STMT_START { \
GObject *_object = (GObject*) (object); \ GObject *_glib__object = (GObject*) (object); \
GParamSpec *_pspec = (GParamSpec*) (pspec); \ GParamSpec *_glib__pspec = (GParamSpec*) (pspec); \
guint _property_id = (property_id); \ guint _glib__property_id = (property_id); \
g_warning ("%s: invalid %s id %u for \"%s\" of type `%s' in `%s'", \ g_warning ("%s: invalid %s id %u for \"%s\" of type `%s' in `%s'", \
G_STRLOC, \ G_STRLOC, \
(pname), \ (pname), \
_property_id, \ _glib__property_id, \
_pspec->name, \ _glib__pspec->name, \
g_type_name (G_PARAM_SPEC_TYPE (_pspec)), \ g_type_name (G_PARAM_SPEC_TYPE (_glib__pspec)), \
G_OBJECT_TYPE_NAME (_object)); \ G_OBJECT_TYPE_NAME (_glib__object)); \
} G_STMT_END } G_STMT_END
/** /**
* G_OBJECT_WARN_INVALID_PROPERTY_ID: * G_OBJECT_WARN_INVALID_PROPERTY_ID: