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 615896 - [PATCH] sometimes useless strdup in g_regex_new
[PATCH] sometimes useless strdup in g_regex_new
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: gregex
2.24.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-04-15 22:31 UTC by Paolo Bonzini
Modified: 2010-05-29 17:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.38 KB, patch)
2010-04-15 22:35 UTC, Paolo Bonzini
none Details | Review

Description Paolo Bonzini 2010-04-15 22:31:07 UTC
This patch adds a new compilation flag G_REGEX_NO_DUP_PATTERN that instructs GRegex to not duplicate the input string.  This is especially useful with g_regex_escape_string, because the result can be passed directly to g_regex_new without storing it elsewhere temporarily, only to free it as soon as g_regex_new returns.
Comment 1 Paolo Bonzini 2010-04-15 22:35:09 UTC
Created attachment 158850 [details] [review]
patch
Comment 2 Behdad Esfahbod 2010-05-29 17:21:20 UTC
The problem is, current compile-flags all instruct how the regex should be interpreted.  Stuffing in a memory-management bit in there is just bad taste.

Plus, then every language binding need to make sure they don't let that flag in or bad things will happen.

Is one malloc() really such a huge deal?  If it really is a huge deal, the way to fix this is to add a new constructor.

Closing WONTFIX as I'm fairly sure that's what mclasen would also do.