[dpdk-dev] [PATCH v3 1/7] eal: add wrappers for POSIX string functions
Andrew Rybchenko
andrew.rybchenko at oktetlabs.ru
Tue Feb 23 08:11:11 CET 2021
On 2/21/21 5:28 PM, Dmitry Kozlyuk wrote:
> POSIX strncasecmp(), strdup(), and strtok_r() have different names
> on Windows, respectively, strnicmp(), _strdup(), and strtok_s().
>
> Add wrappers as inline functions, because they're used from librte_kvargs,
> and thus cannot be in librte_eal; besides, implementation is trivial.
>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
[snip]
> +/**
> + * @internal
> + * strdup(3) replacement for systems that don't have it.
> + */
> +static inline char *
> +rte_strdup(const char *str)
> +{
> +#ifdef RTE_EXEC_ENV_WINDOWS
> + return _strdup(str);
> +#else
> + return strdup(str);
> +#endif
> +}
Allocating memory using rte_strdup() I'd use rte_free()
to release it. I guess it will fail badly.
So, I think that a different, more specific prefix is
required for POSIX wrappers.
More information about the dev
mailing list