Merge branch 'nd/retire-fnmatch'
Replace our use of fnmatch(3) with a more feature-rich wildmatch. A handful patches at the bottom have been moved to nd/wildmatch to graduate as part of that branch, before this series solidifies. We may want to mark USE_WILDMATCH as an experimental curiosity a bit more clearly (i.e. should not be enabled in production environment, because it will make the behaviour between builds unpredictable). * nd/retire-fnmatch: Makefile: add USE_WILDMATCH to use wildmatch as fnmatch wildmatch: advance faster in <asterisk> + <literal> patterns wildmatch: make a special case for "*/" with FNM_PATHNAME test-wildmatch: add "perf" command to compare wildmatch and fnmatch wildmatch: support "no FNM_PATHNAME" mode wildmatch: make dowild() take arbitrary flags wildmatch: rename constants and update prototype
This commit is contained in:
@ -112,7 +112,9 @@
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#ifndef USE_WILDMATCH
|
||||
#include <fnmatch.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <regex.h>
|
||||
#include <utime.h>
|
||||
@ -280,6 +282,17 @@ extern char *gitbasename(char *);
|
||||
|
||||
#include "compat/bswap.h"
|
||||
|
||||
#ifdef USE_WILDMATCH
|
||||
#include "wildmatch.h"
|
||||
#define FNM_PATHNAME WM_PATHNAME
|
||||
#define FNM_CASEFOLD WM_CASEFOLD
|
||||
#define FNM_NOMATCH WM_NOMATCH
|
||||
static inline int fnmatch(const char *pattern, const char *string, int flags)
|
||||
{
|
||||
return wildmatch(pattern, string, flags, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* General helper functions */
|
||||
extern void vreportf(const char *prefix, const char *err, va_list params);
|
||||
extern void vwritef(int fd, const char *prefix, const char *err, va_list params);
|
||||
|
||||
Reference in New Issue
Block a user