public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: fnmatch: drop static variable Date: Tue, 28 Feb 2023 15:46:20 +0000 (GMT) [thread overview] Message-ID: <20230228154620.E1B343858C2C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0d2ad77c40b641ebe2965568945a622f3f6dbd5c commit 0d2ad77c40b641ebe2965568945a622f3f6dbd5c Author: Corinna Vinschen <corinna@vinschen.de> AuthorDate: Tue Feb 28 16:45:52 2023 +0100 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Tue Feb 28 16:45:52 2023 +0100 Cygwin: fnmatch: drop static variable fnmatch calls fnmatch1 with a static mbstate_t. This breaks calling fnmatch from multiple threads. Fix it by folding fnmatch1 into fnmatch and moving all mbstates to local variables. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- winsup/cygwin/libc/fnmatch.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/winsup/cygwin/libc/fnmatch.c b/winsup/cygwin/libc/fnmatch.c index beb67f01e5d1..d109c2124aba 100644 --- a/winsup/cygwin/libc/fnmatch.c +++ b/winsup/cygwin/libc/fnmatch.c @@ -73,22 +73,13 @@ __FBSDID("$FreeBSD: head/lib/libc/gen/fnmatch.c 288309 2015-09-27 12:52:18Z jill #define RANGE_ERROR (-1) static int rangematch(const char *, wint_t, int, char **, mbstate_t *); -static int fnmatch1(const char *, const char *, const char *, int, mbstate_t, - mbstate_t); int fnmatch(const char *pattern, const char *string, int flags) { - static const mbstate_t initial; - - return (fnmatch1(pattern, string, string, flags, initial, initial)); -} - -static int -fnmatch1(const char *pattern, const char *string, const char *stringstart, - int flags, mbstate_t patmbs, mbstate_t strmbs) -{ + const char *stringstart = string; const char *bt_pattern, *bt_string; + mbstate_t patmbs, strmbs; mbstate_t bt_patmbs, bt_strmbs; char *newp; char c;
reply other threads:[~2023-02-28 15:46 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230228154620.E1B343858C2C@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).