alloc-util: Move strdupa_safe() and strndupa_safe() to string-util.h
This commit is contained in:
@@ -223,19 +223,6 @@ static inline size_t malloc_sizeof_safe(void **xp) {
|
||||
MALLOC_SIZEOF_SAFE(x)/sizeof((x)[0]), \
|
||||
VOID_0))
|
||||
|
||||
/* These are like strdupa()/strndupa(), but honour ALLOCA_MAX */
|
||||
#define strdupa_safe(s) \
|
||||
({ \
|
||||
const char *_t = (s); \
|
||||
(char*) memdupa_suffix0(_t, strlen(_t)); \
|
||||
})
|
||||
|
||||
#define strndupa_safe(s, n) \
|
||||
({ \
|
||||
const char *_t = (s); \
|
||||
(char*) memdupa_suffix0(_t, strnlen(_t, n)); \
|
||||
})
|
||||
|
||||
/* Free every element of the array. */
|
||||
static inline void free_many(void **p, size_t n) {
|
||||
assert(p || n == 0);
|
||||
|
||||
Reference in New Issue
Block a user