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.kozl...@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.

Reply via email to