summaryrefslogtreecommitdiff
path: root/gobject
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>2004-02-03 20:30:23 +0000
committerTim Janik <timj@src.gnome.org>2004-02-03 20:30:23 +0000
commit999a87a19a96cd3392f91e93cd3c44ee9daf18b2 (patch)
tree15a3c85f25d8149c120a9f3579ef31c0b519bb73 /gobject
parent341956610c3fe87ceab6e53e932177fe8a9d95a2 (diff)
provide a short-cut version for this macro in case
Tue Feb 3 21:24:01 2004 Tim Janik <timj@gtk.org> * gtype.h (_G_TYPE_CVH): provide a short-cut version for this macro in case value->g_type==checked_type for gcc, similar to instance and class check short-cuts. this speeds up code that makes frequent use of G_VALUE_HOLDS_*() (e.g. setters/getters). * gtype.c (type_data_last_unref_Wm): don't call class-cache functions for the uncached case, this rendered g_type_class_unref_uncached() useless. pointed out by Stefan Westerfeld.
Diffstat (limited to 'gobject')
-rw-r--r--gobject/ChangeLog11
-rw-r--r--gobject/gtype.c5
-rw-r--r--gobject/gtype.h10
3 files changed, 23 insertions, 3 deletions
diff --git a/gobject/ChangeLog b/gobject/ChangeLog
index 3a655df5e..22ec5b077 100644
--- a/gobject/ChangeLog
+++ b/gobject/ChangeLog
@@ -1,3 +1,14 @@
+Tue Feb 3 21:24:01 2004 Tim Janik <timj@gtk.org>
+
+ * gtype.h (_G_TYPE_CVH): provide a short-cut version for
+ this macro in case value->g_type==checked_type for gcc, similar
+ to instance and class check short-cuts. this speeds up code that
+ makes frequent use of G_VALUE_HOLDS_*() (e.g. setters/getters).
+
+ * gtype.c (type_data_last_unref_Wm): don't call class-cache functions
+ for the uncached case, this rendered g_type_class_unref_uncached()
+ useless. pointed out by Stefan Westerfeld.
+
Sat Jan 24 18:20:13 2004 Tim Janik <timj@gtk.org>
* gtype.h: prefixed the parent_class variable defined by G_DEFINE_TYPE()
diff --git a/gobject/gtype.c b/gobject/gtype.c
index 12fb28392..3b773ae75 100644
--- a/gobject/gtype.c
+++ b/gobject/gtype.c
@@ -2009,8 +2009,9 @@ type_data_last_unref_Wm (GType type,
type_descriptive_name_I (type));
return;
}
-
- if (node->is_classed && node->data && node->data->class.class && static_n_class_cache_funcs)
+
+ /* call class cache hooks */
+ if (node->is_classed && node->data && node->data->class.class && static_n_class_cache_funcs && !uncached)
{
guint i;
diff --git a/gobject/gtype.h b/gobject/gtype.h
index 9bf7ac99c..0e9daf879 100644
--- a/gobject/gtype.h
+++ b/gobject/gtype.h
@@ -437,7 +437,6 @@ G_CONST_RETURN gchar* g_type_name_from_class (GTypeClass *g_class);
# define _G_TYPE_CCC(cp, gt, ct) ((ct*) cp)
#endif /* G_DISABLE_CAST_CHECKS */
#define _G_TYPE_CHI(ip) (g_type_check_instance ((GTypeInstance*) ip))
-#define _G_TYPE_CVH(vl, gt) (g_type_check_value_holds ((GValue*) vl, gt))
#define _G_TYPE_CHV(vl) (g_type_check_value ((GValue*) vl))
#define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class))
#define _G_TYPE_IGI(ip, gt, ct) ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt))
@@ -458,9 +457,18 @@ G_CONST_RETURN gchar* g_type_name_from_class (GTypeClass *g_class);
__r = g_type_check_class_is_a (__class, __t); \
__r; \
}))
+# define _G_TYPE_CVH(vl, gt) (G_GNUC_EXTENSION ({ \
+ GValue *__val = (GValue*) vl; GType __t = gt; gboolean __r; \
+ if (__val && __val->g_type == __t) \
+ __r = TRUE; \
+ else \
+ __r = g_type_check_value_holds (__val, __t); \
+ __r; \
+}))
#else /* !__GNUC__ */
# define _G_TYPE_CIT(ip, gt) (g_type_check_instance_is_a ((GTypeInstance*) ip, gt))
# define _G_TYPE_CCT(cp, gt) (g_type_check_class_is_a ((GTypeClass*) cp, gt))
+# define _G_TYPE_CVH(vl, gt) (g_type_check_value_holds ((GValue*) vl, gt))
#endif /* !__GNUC__ */
#define G_TYPE_FLAG_RESERVED_ID_BIT ((GType) (1 << 0))
extern GTypeDebugFlags _g_type_debug_flags;