GNOME Bugzilla – Bug 615896
[PATCH] sometimes useless strdup in g_regex_new
Last modified: 2010-05-29 17:21:20 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.
Created attachment 158850 [details] [review] patch
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.