From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 2/5] compat/wildmatch: remove static variable force_lower_case
Date: Wed, 26 Sep 2012 18:25:38 +0700 [thread overview]
Message-ID: <1348658741-8146-3-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1348658741-8146-1-git-send-email-pclouds@gmail.com>
One place less to worry about thread safety
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
wildmatch.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/wildmatch.c b/wildmatch.c
index f3a1731..e824eb2 100644
--- a/wildmatch.c
+++ b/wildmatch.c
@@ -57,11 +57,10 @@
int wildmatch_iteration_count;
#endif
-static int force_lower_case = 0;
-
/* Match pattern "p" against the a virtually-joined string consisting
* of "text" and any strings in array "a". */
-static int dowild(const uchar *p, const uchar *text, const uchar*const *a)
+static int dowild(const uchar *p, const uchar *text,
+ const uchar*const *a, int force_lower_case)
{
uchar p_ch;
@@ -121,7 +120,7 @@ static int dowild(const uchar *p, const uchar *text, const uchar*const *a)
t_ch = *text;
continue;
}
- if ((matched = dowild(p, text, a)) != FALSE) {
+ if ((matched = dowild(p, text, a, force_lower_case)) != FALSE) {
if (!special || matched != ABORT_TO_STARSTAR)
return matched;
} else if (!special && t_ch == '/')
@@ -291,7 +290,7 @@ int wildmatch(const char *pattern, const char *text)
#ifdef WILD_TEST_ITERATIONS
wildmatch_iteration_count = 0;
#endif
- return dowild((const uchar*)pattern, (const uchar*)text, nomore) == TRUE;
+ return dowild((const uchar*)pattern, (const uchar*)text, nomore, 0) == TRUE;
}
/* Match the "pattern" against the forced-to-lower-case "text" string. */
@@ -302,9 +301,7 @@ int iwildmatch(const char *pattern, const char *text)
#ifdef WILD_TEST_ITERATIONS
wildmatch_iteration_count = 0;
#endif
- force_lower_case = 1;
- ret = dowild((const uchar*)pattern, (const uchar*)text, nomore) == TRUE;
- force_lower_case = 0;
+ ret = dowild((const uchar*)pattern, (const uchar*)text, nomore, 1) == TRUE;
return ret;
}
@@ -331,7 +328,7 @@ int wildmatch_array(const char *pattern, const char*const *texts, int where)
if (!text)
return FALSE;
- if ((matched = dowild(p, text, a)) != TRUE && where < 0
+ if ((matched = dowild(p, text, a, 0)) != TRUE && where < 0
&& matched != ABORT_ALL) {
while (1) {
if (*text == '\0') {
@@ -339,7 +336,7 @@ int wildmatch_array(const char *pattern, const char*const *texts, int where)
return FALSE;
continue;
}
- if (*text++ == '/' && (matched = dowild(p, text, a)) != FALSE
+ if (*text++ == '/' && (matched = dowild(p, text, a, 0)) != FALSE
&& matched != ABORT_TO_STARSTAR)
break;
}
--
1.7.12.1.406.g6ab07c4
next prev parent reply other threads:[~2012-09-26 11:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 11:25 [PATCH 0/5] wildmatch series update Nguyễn Thái Ngọc Duy
2012-09-26 11:25 ` [PATCH 1/5] Import wildmatch from rsync Nguyễn Thái Ngọc Duy
2012-10-02 14:07 ` Ævar Arnfjörð Bjarmason
[not found] ` <CAHSx_SsnSAV7SVLRnAFvS7AmdRgPkPX3NEM+6HTjfW5r8hXeig@mail.gmail.com>
2012-10-02 18:26 ` Junio C Hamano
2012-09-26 11:25 ` Nguyễn Thái Ngọc Duy [this message]
2012-09-26 11:25 ` [PATCH 3/5] compat/wildmatch: fix case-insensitive matching Nguyễn Thái Ngọc Duy
2012-09-26 11:25 ` [PATCH 4/5] Integrate wildmatch to git Nguyễn Thái Ngọc Duy
2012-09-26 11:25 ` [PATCH 5/5] Support "**" in .gitignore and .gitattributes patterns using wildmatch() Nguyễn Thái Ngọc Duy
2012-09-27 18:08 ` [PATCH 0/5] wildmatch series update Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2012-09-15 12:01 [PATCH 0/5] Support matching "**" in .gitattributes and .gitignore Nguyễn Thái Ngọc Duy
2012-09-15 12:02 ` [PATCH 2/5] compat/wildmatch: remove static variable force_lower_case Nguyễn Thái Ngọc Duy
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=1348658741-8146-3-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.