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.
This commit is contained in:
Tim Janik 2004-02-03 20:30:23 +00:00 committed by Tim Janik
parent 341956610c
commit 999a87a19a
5 changed files with 34 additions and 5 deletions

View File

@ -819,6 +819,17 @@ nesting such as <literal>g_ascii_strup (g_strcanon (str, "abc", '?'))</literal>.
@Returns:
<!-- ##### FUNCTION g_strsplit_set ##### -->
<para>
</para>
@string:
@delimiters:
@max_tokens:
@Returns:
<!-- ##### FUNCTION g_strfreev ##### -->
<para>

View File

@ -1613,8 +1613,6 @@ Any one-time initialization function must have its own unique <structname>GOnce<
struct.
</para>
@status:
@retval:
@Since: 2.4
<!-- ##### ENUM GOnceStatus ##### -->

View File

@ -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()

View File

@ -2010,7 +2010,8 @@ type_data_last_unref_Wm (GType 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;

View File

@ -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;