summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2013-06-27 15:07:26 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2013-07-05 18:14:59 +0100
commita2a6cb2058bc29e332a1331cf2fbd50f97a02f0d (patch)
tree2c8094e2a68d54c0180d488f3aaedc1ee2589a2e
parent55941c1e1a87e84af5d2af1fce37ddad43772f8d (diff)
downloadglib-a2a6cb2058bc29e332a1331cf2fbd50f97a02f0d.tar.gz
Drop an unnecessary argument from G_DEFINE_PROPERTIESwip/gproperty-2
By renaming the variable holding the properties array (which can also conflict with existing code) we can avoid the lowercase type name.
-rw-r--r--gobject/gproperty.h23
-rw-r--r--gobject/gtype.h4
-rw-r--r--gobject/tests/property.c2
3 files changed, 14 insertions, 15 deletions
diff --git a/gobject/gproperty.h b/gobject/gproperty.h
index 35aca858c..0864b1f20 100644
--- a/gobject/gproperty.h
+++ b/gobject/gproperty.h
@@ -497,18 +497,17 @@ void g_property_init_default (GProperty *property,
GPtrArray *g_define_properties = g_ptr_array_new (); \
g_ptr_array_add (g_define_properties, NULL);
-#define _G_DEFINE_PROPERTIES_END(T_N, t_n, g_class) \
- t_n##_properties_len = g_define_properties->len; \
- t_n##_properties = (GParamSpec **) g_ptr_array_free (g_define_properties, FALSE); \
+#define _G_DEFINE_PROPERTIES_END(TypeName, g_class) \
+ TypeName##_properties_len = g_define_properties->len; \
+ TypeName##_properties = (GParamSpec **) g_ptr_array_free (g_define_properties, FALSE); \
g_object_class_install_properties (G_OBJECT_CLASS (g_class), \
- t_n##_properties_len, \
- t_n##_properties); \
+ TypeName##_properties_len, \
+ TypeName##_properties); \
}
/**
* G_DEFINE_PROPERTIES:
* @T_N: the name of the type, in CamelCase
- * @t_n: the name of the type, in lower case, with spaces replaced by underscores
* @g_class: a pointer to the class structure of the type
* @_C_: a list of G_DEFINE_PROPERTY_EXTENDED calls
*
@@ -520,10 +519,10 @@ void g_property_init_default (GProperty *property,
*
* Since: 2.38
*/
-#define G_DEFINE_PROPERTIES(T_N, t_n, g_class, _C_) \
+#define G_DEFINE_PROPERTIES(T_N, g_class, _C_) \
_G_DEFINE_PROPERTIES_BEGIN() \
{ _C_; } \
- _G_DEFINE_PROPERTIES_END(T_N, t_n, g_class)
+ _G_DEFINE_PROPERTIES_END(T_N, g_class)
#define _G_DEFINE_DIRECT_PROPERTY_EXTENDED_BEGIN(T_N, c_type, name, flags) \
{ \
@@ -711,9 +710,9 @@ void g_property_init_default (GProperty *property,
const char *pname = g_property_canonicalize_name (#f_n); \
int i; \
\
- for (i = 1; i < t_n##_properties_len; i++) \
+ for (i = 1; i < T_N##_properties_len; i++) \
{ \
- GParamSpec *pspec = t_n##_properties[i]; \
+ GParamSpec *pspec = T_N##_properties[i]; \
if (pspec != NULL && pspec->name == pname) \
{ \
g_property = (GProperty *) pspec; \
@@ -755,9 +754,9 @@ void g_property_init_default (GProperty *property,
const char *pname = g_property_canonicalize_name (#f_n); \
int i; \
\
- for (i = 1; i < t_n##_properties_len; i++) \
+ for (i = 1; i < T_N##_properties_len; i++) \
{ \
- GParamSpec *pspec = t_n##_properties[i]; \
+ GParamSpec *pspec = T_N##_properties[i]; \
if (pspec != NULL && pspec->name == pname) \
{ \
g_property = (GProperty *) pspec; \
diff --git a/gobject/gtype.h b/gobject/gtype.h
index 75686da83..5e5a58f26 100644
--- a/gobject/gtype.h
+++ b/gobject/gtype.h
@@ -1665,8 +1665,8 @@ static void type_name##_init (TypeName *self); \
static void type_name##_class_init (TypeName##Class *klass); \
static gpointer type_name##_parent_class = NULL; \
static gint TypeName##_private_offset; \
-static GParamSpec **type_name##_properties G_GNUC_UNUSED; \
-static guint type_name##_properties_len G_GNUC_UNUSED; \
+static GParamSpec **TypeName##_properties G_GNUC_UNUSED; \
+static guint TypeName##_properties_len G_GNUC_UNUSED; \
\
_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
\
diff --git a/gobject/tests/property.c b/gobject/tests/property.c
index 9b8614299..a46655a4b 100644
--- a/gobject/tests/property.c
+++ b/gobject/tests/property.c
@@ -118,7 +118,7 @@ test_object_class_init (TestObjectClass *klass)
gobject_class->constructed = test_object_constructed;
gobject_class->finalize = test_object_finalize;
- G_DEFINE_PROPERTIES (TestObject, test_object, klass,
+ G_DEFINE_PROPERTIES (TestObject, klass,
G_DEFINE_PROPERTY (TestObject,
int,
integer_val,