Re: [PATCH 1/6] Add string comparison functions that respect the ignore_case variable.
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:49:24
Ævar Arnfjörð Bjarmason wrote:
I don't think duplicating the GNU (or *BSD) version into a compat/fnmatch.c would be a bad thing. See e.g. compat/snprintf.c.
Maybe meanwhile someone (I guess that means "I") can ask around about FNM_CASEFOLD going into posix. I like to imagine the compat/ directory shrinking over time.
quoted
You added COMPAT_OBJS above, but I think there is no linker guarantee it will pick up compat/fnmatch/fnmatch.o over the C runtime version? Perhaps the makefile is architected to do so.It's probably just an artifact of how the Solaris linker works
Isn't the portable way to do something like #define fnmatch gitfnmatch in fnmatch.h? Meanwhile I guess that no other system header includes fnmatch.h, but if that were to happen, there would be preprocessor symbol conflicts. So on systems with fnmatch, ideally one would want to do something like this: #include <fnmatch.h> #ifdef FNMATCH_LACKS_CASEFOLD # undef FNM_PATHNAME # define FNM_PATHNAME (1 << 0) # define FNM_CASEFOLD (1 << 4) # define fnmatch gitfnmatch extern int fnmatch(const char *pattern, const char *name, int flags); #endif