[PATCH] stdlib: Remove cache from rpmatch (bug 34526)
Collin Funk
collin.funk1@gmail.com
Sat Aug 15 16:39:36 GMT 2026
Florian Weimer <fweimer@redhat.com> 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 <collin.funk1@gmail.com>
Collin
More information about the Libc-alpha
mailing list