From: Jonathan Nieder Date: Mon, 30 Aug 2010 15:05:13 GMT Subject: Re: [PATCH 1/6] Add string comparison functions that respect the ignore_case variable. Message-ID: <20100830150513.GJ2315@burratino> In-Reply-To: Æ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. >> 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 #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