From: Masahiro Yamada <masahiroy@kernel.org>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"Masahiro Yamada" <masahiroy@kernel.org>
Subject: [PATCH 3/5] wildmatch: remove NEGATE_CLASS and NEGATE_CLASS2 macros
Date: Fri, 10 Feb 2023 16:59:37 +0900 [thread overview]
Message-ID: <20230210075939.44949-4-masahiroy@kernel.org> (raw)
In-Reply-To: <20230210075939.44949-1-masahiroy@kernel.org>
The other glob patterns are hard-coded in dowild(). Do likewise.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
wildmatch.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/wildmatch.c b/wildmatch.c
index a510b3fd23..93800b8eac 100644
--- a/wildmatch.c
+++ b/wildmatch.c
@@ -14,10 +14,6 @@
typedef unsigned char uchar;
-/* What character marks an inverted character class? */
-#define NEGATE_CLASS '!'
-#define NEGATE_CLASS2 '^'
-
#define CC_EQ(class, len, litmatch) ((len) == sizeof (litmatch)-1 \
&& *(class) == *(litmatch) \
&& strncmp((char*)class, litmatch, len) == 0)
@@ -137,12 +133,8 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
return WM_ABORT_ALL;
case '[':
p_ch = *++p;
-#ifdef NEGATE_CLASS2
- if (p_ch == NEGATE_CLASS2)
- p_ch = NEGATE_CLASS;
-#endif
/* Assign literal 1/0 because of "matched" comparison. */
- negated = p_ch == NEGATE_CLASS ? 1 : 0;
+ negated = p_ch == '!' || p_ch == '^' ? 1 : 0;
if (negated) {
/* Inverted character class. */
p_ch = *++p;
--
2.34.1
next prev parent reply other threads:[~2023-02-10 8:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-10 7:59 [PATCH 0/5] Clean up wildmatch.c Masahiro Yamada
2023-02-10 7:59 ` [PATCH 1/5] git-compat-util: add isblank() and isgraph() Masahiro Yamada
2023-02-10 13:16 ` Ævar Arnfjörð Bjarmason
2023-02-10 16:56 ` Masahiro Yamada
2023-02-10 19:10 ` Junio C Hamano
2023-02-10 19:25 ` Masahiro Yamada
2023-02-10 22:03 ` René Scharfe
2023-02-11 7:01 ` Masahiro Yamada
2023-02-11 13:48 ` René Scharfe
2023-02-11 14:11 ` René Scharfe
2023-02-10 7:59 ` [PATCH 2/5] wildmatch: remove IS*() macros Masahiro Yamada
2023-02-10 7:59 ` Masahiro Yamada [this message]
2023-02-10 13:11 ` [PATCH 3/5] wildmatch: remove NEGATE_CLASS and NEGATE_CLASS2 macros Ævar Arnfjörð Bjarmason
2023-02-10 17:03 ` Masahiro Yamada
2023-02-10 7:59 ` [PATCH 4/5] wildmatch: use char instead of uchar Masahiro Yamada
2023-02-10 13:09 ` Ævar Arnfjörð Bjarmason
2023-02-10 7:59 ` [PATCH 5/5] wildmatch: more cleanups after killing uchar Masahiro Yamada
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=20230210075939.44949-4-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.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 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 NNTP newsgroup(s).