wildmatch: hide internal return values
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood committed
Mar 20, 2023 at 16:10 UTC
91b81b64e332da185d3ac8679a977c665c80914e
2 files changed
+6
-3
wildmatch.c
+6
-1
@@ -14,6 +14,10 @@
14
15
typedef unsigned char uchar;
16
17
+/* Internal return values */
18
+#define WM_ABORT_ALL -1
19
+#define WM_ABORT_TO_STARSTAR -2
20
+
21
/* What character marks an inverted character class? */
22
#define NEGATE_CLASS '!'
23
#define NEGATE_CLASS2 '^'
@@ -278,5 +282,6 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
282
/* Match the "pattern" against the "text" string. */
283
int wildmatch(const char *pattern, const char *text, unsigned int flags)
284
{
281
- return dowild((const uchar*)pattern, (const uchar*)text, flags);
285
+ int res = dowild((const uchar*)pattern, (const uchar*)text, flags);
286
+ return res == WM_MATCH ? WM_MATCH : WM_NOMATCH;
287
}
wildmatch.h
-2
@@ -6,8 +6,6 @@
6
7
#define WM_NOMATCH 1
8
#define WM_MATCH 0
9
-#define WM_ABORT_ALL -1
10
-#define WM_ABORT_TO_STARSTAR -2
9
10
int wildmatch(const char *pattern, const char *text, unsigned int flags);
11
#endif