mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
utils: provide strdupa() if not in libc
FreeBSD does not have strdupa(), provide it locally then. Macro by: Gleb Popov <arrowd@FreeBSD.org>
This commit is contained in:
parent
c89af625db
commit
685ff1dc25
2 changed files with 11 additions and 0 deletions
|
|
@ -40,6 +40,7 @@
|
|||
#include <spa/param/profiler.h>
|
||||
#include <spa/debug/pod.h>
|
||||
|
||||
#include <pipewire/utils.h>
|
||||
#include <pipewire/private.h>
|
||||
#include <pipewire/impl.h>
|
||||
#include <extensions/profiler.h>
|
||||
|
|
|
|||
|
|
@ -66,6 +66,16 @@ pw_strip(char *str, const char *whitespace);
|
|||
})
|
||||
#endif
|
||||
|
||||
#if !defined(strdupa)
|
||||
# define strdupa(s) \
|
||||
({ \
|
||||
const char *__old = (s); \
|
||||
size_t __len = strlen(__old) + 1; \
|
||||
char *__new = (char *) alloca(__len); \
|
||||
(char *) memcpy(__new, __old, __len); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue