From: Phillip Wood <phillip.wood123@gmail.com>
To: git@vger.kernel.org
Cc: Derrick Stolee <derrickstolee@github.com>,
Jeff King <peff@peff.net>,
Phillip Wood <phillip.wood123@gmail.com>,
Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: [PATCH 3/3] wildmatch: hide internal return values
Date: Mon, 20 Mar 2023 16:10:02 +0000 [thread overview]
Message-ID: <a74ab7138be28db54bd26d352f0eaecc54978c1f.1679328580.git.phillip.wood@dunelm.org.uk> (raw)
In-Reply-To: <cover.1679328580.git.phillip.wood@dunelm.org.uk>
From: Phillip Wood <phillip.wood@dunelm.org.uk>
WM_ABORT_ALL and WM_ABORT_TO_STARSTAR are used internally to limit
backtracking when a match fails, they are not of interest to the caller
and so should not be public.
Suggested-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
wildmatch.c | 7 ++++++-
wildmatch.h | 2 --
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/wildmatch.c b/wildmatch.c
index 694d2f8e40..372aa6ea54 100644
--- a/wildmatch.c
+++ b/wildmatch.c
@@ -14,6 +14,10 @@
typedef unsigned char uchar;
+/* Internal return values */
+#define WM_ABORT_ALL -1
+#define WM_ABORT_TO_STARSTAR -2
+
/* What character marks an inverted character class? */
#define NEGATE_CLASS '!'
#define NEGATE_CLASS2 '^'
@@ -278,5 +282,6 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
/* Match the "pattern" against the "text" string. */
int wildmatch(const char *pattern, const char *text, unsigned int flags)
{
- return dowild((const uchar*)pattern, (const uchar*)text, flags);
+ int res = dowild((const uchar*)pattern, (const uchar*)text, flags);
+ return res == WM_MATCH ? WM_MATCH : WM_NOMATCH;
}
diff --git a/wildmatch.h b/wildmatch.h
index 5993696298..0c890cb56b 100644
--- a/wildmatch.h
+++ b/wildmatch.h
@@ -6,8 +6,6 @@
#define WM_NOMATCH 1
#define WM_MATCH 0
-#define WM_ABORT_ALL -1
-#define WM_ABORT_TO_STARSTAR -2
int wildmatch(const char *pattern, const char *text, unsigned int flags);
#endif
--
2.39.2
next prev parent reply other threads:[~2023-03-20 16:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 16:09 [PATCH 0/3] wildmatch: fix exponential behavior Phillip Wood
2023-03-20 16:10 ` [PATCH 1/3] " Phillip Wood
2023-03-24 22:17 ` [PATCH] t3070: make chain lint tester happy Michael J Gruber
2023-03-25 6:37 ` Jeff King
2023-03-25 6:54 ` Eric Sunshine
2023-03-25 7:58 ` Jeff King
2023-03-25 8:04 ` Jeff King
2023-03-25 8:18 ` Eric Sunshine
2023-03-25 8:41 ` Jeff King
2023-03-25 8:51 ` Jeff King
2023-03-25 9:09 ` Eric Sunshine
2023-03-25 19:47 ` Jeff King
2023-03-25 9:17 ` Eric Sunshine
2023-03-26 14:30 ` Phillip Wood
2023-03-26 14:54 ` Michael J Gruber
2023-03-25 8:06 ` Eric Sunshine
2023-03-25 8:36 ` Jeff King
2023-03-20 16:10 ` [PATCH 2/3] wildmatch: avoid undefined behavior Phillip Wood
2023-03-20 16:10 ` Phillip Wood [this message]
2023-03-20 17:58 ` [PATCH 0/3] wildmatch: fix exponential behavior Junio C Hamano
2023-03-23 14:19 ` Derrick Stolee
2023-03-24 14:04 ` Phillip Wood
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a74ab7138be28db54bd26d352f0eaecc54978c1f.1679328580.git.phillip.wood@dunelm.org.uk \
--to=phillip.wood123@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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).