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 741654 - [patch] gobject: don't use G_STRLOC in G_OBJECT_WARN_INVALID_PSPEC() macro
[patch] gobject: don't use G_STRLOC in G_OBJECT_WARN_INVALID_PSPEC() macro
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-12-17 14:34 UTC by Thomas Haller
Modified: 2014-12-18 14:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[patch] gobject: don't use G_STRLOC in G_OBJECT_WARN_INVALID_PSPEC() macro (1.38 KB, patch)
2014-12-17 14:35 UTC, Thomas Haller
committed Details | Review

Description Thomas Haller 2014-12-17 14:34:22 UTC
Using G_STRLOC ends up embedding unique strings of the form
    __FILE__:__LINE__ in the compiled binary. We can avoid these
    by passing __FILE__ and __LINE__ separately when constructing
    the warning text.
    This probably reduces the size of the binary as __FILE__ is
    likely already contained as string otherwise.
    
    Note that for GCC 2.x this changes behavior because G_STRLOC
    also contained __PRETTY_FUNCTION__.




For example in NetworkManager project, there are more than 300 uses of G_OBJECT_WARN_INVALID_PROPERTY_ID(). This patch would save quite some static strings.
Comment 1 Thomas Haller 2014-12-17 14:35:17 UTC
Created attachment 292905 [details] [review]
[patch] gobject: don't use G_STRLOC in G_OBJECT_WARN_INVALID_PSPEC() macro
Comment 2 Allison Karlitskaya (desrt) 2014-12-17 16:41:21 UTC
Review of attachment 292905 [details] [review]:

Looks nice, and well-justified.  Fine by me.

fwiw, we don't do Signed-off-by: lines in GLib.