After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 372461 - use G_UNLIKELY(type==0) in get_type functions
use G_UNLIKELY(type==0) in get_type functions
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-11-08 13:53 UTC by Christian Persch
Modified: 2007-08-17 09:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (25.28 KB, patch)
2006-11-08 13:53 UTC, Christian Persch
none Details | Review

Description Christian Persch 2006-11-08 13:53:23 UTC
The G_DEFINE_TYPE macros do this, so I see no reason not to do it also in the manually coded or autogenerated (type builtins) get_type functions.
Comment 1 Christian Persch 2006-11-08 13:53:40 UTC
Created attachment 76207 [details] [review]
patch
Comment 2 Xan Lopez 2007-06-17 13:02:23 UTC
This looks good to me, but I wonder (without looking much at the code) if some of the manually coded get_type functions shouldn't be replaced by the provided macros instead.
Comment 3 Tim Janik 2007-08-17 09:10:09 UTC
(In reply to comment #0)
> The G_DEFINE_TYPE macros do this, so I see no reason not to do it also in the
> manually coded or autogenerated (type builtins) get_type functions.

thanks, but this is not needed. all those _get_type() functions should actually use g_once_init_{enter|leave} instead, that also implements type_id check likelyness. so if you want to provide a patch, please provide one that makes the _get_type() functions thread-safe (in a  new bug report though), gtype.h and glib/tests/onceinit.c:initializer1() contain simple example code.