Skip to content

Commit 91b81b6

Browse files
phillipwoodgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Phillip Wood <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 81b26f8 commit 91b81b6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

wildmatch.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
typedef unsigned char uchar;
1616

17+
/* Internal return values */
18+
#define WM_ABORT_ALL -1
19+
#define WM_ABORT_TO_STARSTAR -2
20+
1721
/* What character marks an inverted character class? */
1822
#define NEGATE_CLASS '!'
1923
#define NEGATE_CLASS2 '^'
@@ -278,5 +282,6 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
278282
/* Match the "pattern" against the "text" string. */
279283
int wildmatch(const char *pattern, const char *text, unsigned int flags)
280284
{
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;
282287
}

wildmatch.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
#define WM_NOMATCH 1
88
#define WM_MATCH 0
9-
#define WM_ABORT_ALL -1
10-
#define WM_ABORT_TO_STARSTAR -2
119

1210
int wildmatch(const char *pattern, const char *text, unsigned int flags);
1311
#endif

0 commit comments

Comments
 (0)