Add alloca_strdup() macro

This commit is contained in:
Andrew Bettison 2013-10-23 00:58:09 +10:30
parent 1a413b72db
commit 4de6c77d45

2
str.h
View File

@ -68,6 +68,8 @@ size_t strn_fromhex(unsigned char *dstBinary, ssize_t dstlen, const char *src, c
#define alloca_tohex(buf,bytes) tohex((char *)alloca((bytes)*2+1), (bytes) * 2, (buf)) #define alloca_tohex(buf,bytes) tohex((char *)alloca((bytes)*2+1), (bytes) * 2, (buf))
#define alloca_strdup(str) strcpy(alloca(strlen(str) + 1), (str))
__STR_INLINE int hexvalue(char c) __STR_INLINE int hexvalue(char c)
{ {
switch (c) { switch (c) {