[mutter/wip/nielsdg/coglhandle-stepped-approach: 2/4] cogl: Deduplicate cogl_is_* macro generation
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/nielsdg/coglhandle-stepped-approach: 2/4] cogl: Deduplicate cogl_is_* macro generation
- Date: Wed, 20 Feb 2019 13:54:16 +0000 (UTC)
commit 094ecbcaeb20f0708ec953e87e6e0224ec8cc842
Author: Niels De Graef <niels degraef barco com>
Date: Wed Feb 20 14:23:37 2019 +0100
cogl: Deduplicate cogl_is_* macro generation
cogl/cogl/cogl-object-private.h | 42 ++++++++++-------------------------------
1 file changed, 10 insertions(+), 32 deletions(-)
---
diff --git a/cogl/cogl/cogl-object-private.h b/cogl/cogl/cogl-object-private.h
index 510d992f2..fc3832671 100644
--- a/cogl/cogl/cogl-object-private.h
+++ b/cogl/cogl/cogl-object-private.h
@@ -193,14 +193,7 @@ _cogl_##type_name##_object_new (Cogl##TypeName *new_obj) \
_cogl_object_##type_name##_inc (); \
_COGL_OBJECT_DEBUG_NEW (TypeName, obj); \
return new_obj; \
-}
-
-#define COGL_OBJECT_DEFINE_WITH_CODE_GTYPE(TypeName, type_name, code) \
- \
-COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, \
- type_name, \
- do { code; } while (0); \
- _COGL_GTYPE_INIT_CLASS (type_name)) \
+} \
\
gboolean \
cogl_is_##type_name (void *object) \
@@ -213,35 +206,20 @@ cogl_is_##type_name (void *object) \
return obj->klass == &_cogl_##type_name##_class; \
}
-#define COGL_OBJECT_DEFINE_WITH_CODE(TypeName, type_name, code) \
- \
-COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code) \
- \
-gboolean \
-cogl_is_##type_name (void *object) \
-{ \
- CoglObject *obj = object; \
+#define COGL_OBJECT_DEFINE_WITH_CODE_GTYPE(TypeName, type_name, code) \
\
- if (object == NULL) \
- return FALSE; \
+COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, \
+ type_name, \
+ do { code; } while (0); \
+ _COGL_GTYPE_INIT_CLASS (type_name))
+
+#define COGL_OBJECT_DEFINE_WITH_CODE(TypeName, type_name, code) \
\
- return obj->klass == &_cogl_##type_name##_class; \
-}
+COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code)
#define COGL_OBJECT_INTERNAL_DEFINE_WITH_CODE(TypeName, type_name, code) \
\
-COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code) \
- \
-gboolean \
-_cogl_is_##type_name (void *object) \
-{ \
- CoglObject *obj = object; \
- \
- if (object == NULL) \
- return FALSE; \
- \
- return obj->klass == &_cogl_##type_name##_class; \
-}
+COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code)
#define COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING(type_name) \
\
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]