* string/string.h (strndupa): Add cast for C++ conformance.
(strdupa): Likewise. Fixes PR libc/2173, reported by tbrowder@home.com.
This commit is contained in:
parent
8a0746ae74
commit
8c8f37042c
@ -135,7 +135,7 @@ extern char *strndup (__const char *__string, size_t __n)
|
|||||||
({ \
|
({ \
|
||||||
__const char *__old = (s); \
|
__const char *__old = (s); \
|
||||||
size_t __len = strlen (__old) + 1; \
|
size_t __len = strlen (__old) + 1; \
|
||||||
char *__new = __builtin_alloca (__len); \
|
char *__new = (char *) __builtin_alloca (__len); \
|
||||||
(char *) memcpy (__new, __old, __len); \
|
(char *) memcpy (__new, __old, __len); \
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ extern char *strndup (__const char *__string, size_t __n)
|
|||||||
({ \
|
({ \
|
||||||
__const char *__old = (s); \
|
__const char *__old = (s); \
|
||||||
size_t __len = strnlen (__old, (n)); \
|
size_t __len = strnlen (__old, (n)); \
|
||||||
char *__new = __builtin_alloca (__len + 1); \
|
char *__new = (char *) __builtin_alloca (__len + 1); \
|
||||||
__new[__len] = '\0'; \
|
__new[__len] = '\0'; \
|
||||||
(char *) memcpy (__new, __old, __len); \
|
(char *) memcpy (__new, __old, __len); \
|
||||||
}))
|
}))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user