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>
This commit is contained in:
Phillip Wood 2023-03-20 16:10:02 +00:00 коммит произвёл Junio C Hamano
Родитель 81b26f8f28
Коммит 91b81b64e3
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -14,6 +14,10 @@
typedef unsigned char uchar; 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? */ /* What character marks an inverted character class? */
#define NEGATE_CLASS '!' #define NEGATE_CLASS '!'
#define NEGATE_CLASS2 '^' #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. */ /* Match the "pattern" against the "text" string. */
int wildmatch(const char *pattern, const char *text, unsigned int flags) 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;
} }

Просмотреть файл

@ -6,8 +6,6 @@
#define WM_NOMATCH 1 #define WM_NOMATCH 1
#define WM_MATCH 0 #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); int wildmatch(const char *pattern, const char *text, unsigned int flags);
#endif #endif