[RFC PATCH v2 1/3] eal/windows: move fnmatch function to header file

Morten Brørup mb at smartsharesystems.com
Fri Jan 13 17:41:29 CET 2023


> From: Bruce Richardson [mailto:bruce.richardson at intel.com]
> Sent: Friday, 13 January 2023 17.20
> 
> 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.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> ---

[...]

>  #define FNM_CASEFOLD 0x10
>  #define FNM_PREFIX_DIRS 0x20
> 
> +#define EOS	'\0'

Careful about names in header files. Perhaps EOS should also have the FNM_ name space prefix to reduce the risk of collision. Or even better: just use '\0' in the code instead of defining a special name for it.

> +
> +static const char *rangematch(const char *, char, int);

I don't think rangematch() is a POSIX function, so similar comment here. Prefix with fnm_ to reduce risk of collision.

With those fixes...

Series-acked-by: Morten Brørup <mb at smartsharesystems.com>



More information about the dev mailing list