On Wed, Aug 09, 2023 at 01:18:56PM +0200, David Marchand wrote: > On Mon, Jul 31, 2023 at 5:39 PM Bruce Richardson > <bruce.richard...@intel.com> wrote: > > > > To allow the fnmatch function to be shared between libraries, without > > having to export it into the public namespace (since it's not prefixed > > with "rte"), we can convert fnmatch.c to replace fnmatch.h. This allows > > fnmatch function to be static and limited in scope to the current file, > > preventing duplicate definitions if it is used by two libraries, while > > also not requiring export for sharing. > > Overall, it lgtm. > > I am surprised those 3 static symbols (see below) do not require being > marked "inline" (to avoid "unused symbols" warnings). > The CI looks ok, so probably I am just paranoid.
Only the functions should need the inline, and I suspect that we don't get any warnings, since the only files including the header always use the functions. Will mark them as inline just in case in next version. > > I have also a comment on sccsid, see below. > > > > > > Signed-off-by: Bruce Richardson <bruce.richard...@intel.com> > > Acked-by: Morten Brørup <m...@smartsharesystems.com> > > Acked-by: Tyler Retzlaff <roret...@linux.microsoft.com> > > --- > > [snip] > > > diff --git a/lib/eal/windows/include/fnmatch.h > > b/lib/eal/windows/include/fnmatch.h > > index c6b226bd5d..fbf1eef21c 100644 > > --- a/lib/eal/windows/include/fnmatch.h > > +++ b/lib/eal/windows/include/fnmatch.h > > @@ -1,20 +1,25 @@ > > /* SPDX-License-Identifier: BSD-3-Clause > > - * Copyright(c) 2019 Intel Corporation > > + * Copyright (c) 1989, 1993, 1994 > > + * The Regents of the University of California. All rights reserved. > > + * > > + * This code is derived from software contributed to Berkeley by > > + * Guido van Rossum. > > */ > > - > > #ifndef _FNMATCH_H_ > > #define _FNMATCH_H_ > > > > -/** > > - * This file is required to support the common code in eal_common_log.c > > - * as Microsoft libc does not contain fnmatch.h. This may be removed in > > - * future releases. > > +#if defined(LIBC_SCCS) && !defined(lint) > > +static const char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94"; > > +#endif /* LIBC_SCCS and not lint */ > > Strange to keep this (what looks to be a canary) symbol in a header file. > > [snip] > Yeah, missed that, can probably be removed. > > @@ -25,6 +30,10 @@ extern "C" { > > #define FNM_CASEFOLD 0x10 > > #define FNM_PREFIX_DIRS 0x20 > > > > +#define FNM_EOS '\0' > > + > > +static const char *fnm_rangematch(const char *, char, int); > > + > > /** > > * This function is used for searching a given string source > > * with the given regular expression pattern. > > [snip] > > > > @@ -41,10 +50,150 @@ extern "C" { > > * @return > > * if the pattern is found then return 0 or else FNM_NOMATCH > > */ > > -int fnmatch(const char *pattern, const char *string, int flags); > > +static int > > +fnmatch(const char *pattern, const char *string, int flags) > > +{ > > + const char *stringstart; > > + char c, test; > > > -- > David Marchand >