Re: [PATCH] stdlib: Remove cache from rpmatch (bug 34526)

Collin Funk <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
Florian Weimer <[email protected]> writes:

> It is not thread-safe.  Furthermore, the cache invalidation logic did
> not account for deallocation in uselocale (which could change the regexp
> without change its pointer).
>
> Given that this code is unlikely to be performance-senstive
> (it is for interactive use) and the regular expressions are very
> short, allocate and deallocate the regular expressions on each
> call.
>
> ---
>  stdlib/rpmatch.c | 39 +++++++++++++++------------------------
>  1 file changed, 15 insertions(+), 24 deletions(-)

I'm guessing most programs using this just set their locale at startup
and don't touch it again, which is why this wasn't noticed previously.

The patch looks good to me, though.

Reviewed-by: Collin Funk <[email protected]>

Collin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.