2011-06-09 Yaakov Selkowitz <yselkowitz@...>
* libc/include/string.h (strdupa): New macro function. (strndupa): New macro function.
This commit is contained in:
parent
1516a0b4d7
commit
38e356f0e4
|
@ -1,3 +1,8 @@
|
||||||
|
2011-06-09 Yaakov Selkowitz <yselkowitz@...>
|
||||||
|
|
||||||
|
* libc/include/string.h (strdupa): New macro function.
|
||||||
|
(strndupa): New macro function.
|
||||||
|
|
||||||
2011-05-27 Nick Clifton <nickc@redhat.com>
|
2011-05-27 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* libc/sys/sysnecv850/sbrk.c (_sbrk): Tidy code.
|
* libc/sys/sysnecv850/sbrk.c (_sbrk): Tidy code.
|
||||||
|
|
|
@ -99,6 +99,20 @@ int _EXFUN(strtosigno, (const char *__name));
|
||||||
/* Recursive version of strerror. */
|
/* Recursive version of strerror. */
|
||||||
char * _EXFUN(_strerror_r, (struct _reent *, int, int, int *));
|
char * _EXFUN(_strerror_r, (struct _reent *, int, int, int *));
|
||||||
|
|
||||||
|
#if defined _GNU_SOURCE && defined __GNUC__
|
||||||
|
#define strdupa(__s) \
|
||||||
|
(__extension__ ({const char *__in = (__s); \
|
||||||
|
size_t __len = strlen (__in) + 1; \
|
||||||
|
char * __out = (char *) __builtin_alloca (__len); \
|
||||||
|
(char *) memcpy (__out, __in, __len);}))
|
||||||
|
#define strndupa(__s, __n) \
|
||||||
|
(__extension__ ({const char *__in = (__s); \
|
||||||
|
size_t __len = strnlen (__in, (__n)) + 1; \
|
||||||
|
char *__out = (char *) __builtin_alloca (__len); \
|
||||||
|
__out[__len-1] = '\0'; \
|
||||||
|
(char *) memcpy (__out, __in, __len-1);}))
|
||||||
|
#endif /* _GNU_SOURCE && __GNUC__ */
|
||||||
|
|
||||||
/* These function names are used on Windows and perhaps other systems. */
|
/* These function names are used on Windows and perhaps other systems. */
|
||||||
#ifndef strcmpi
|
#ifndef strcmpi
|
||||||
#define strcmpi strcasecmp
|
#define strcmpi strcasecmp
|
||||||
|
|
Loading…
Reference in New Issue