|
From: | Paolo Bonzini |
Subject: | RE_NO_SUB thread-safety (was Re: A little more regex.h pedantry) |
Date: | Sat, 31 Jul 2010 17:15:36 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 |
On 07/31/2010 12:52 AM, Eric Blake wrote:
> The code in re_compile_pattern says: > > /* And GNU code determines whether or not to get register information > by passing null for the REGS argument to re_match, etc., not by > setting no_sub, unless RE_NO_SUB is set. */ > bufp->no_sub = !!(re_syntax_options & RE_NO_SUB); > > It doesn't seem to be conditional on grouping.Aha. The answer, then, is that you used to be able to supply no_sub prior to compilation; but nowadays you have the flag RE_NO_SUB to do the job instead. So I agree with documenting that no_sub is private (by not listing it as public).
This is unfortunate because it is not thread safe. I never noticed this problem with the GNU API, but it is quite bad.
Glibc people, would you agree with adding a re_compile_pattern_with_syntax function (which would likely be a good idea anyway)?
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |