From 4344b8c8987cb5627f9ada36ae7a6e19d95ada33 Mon Sep 17 00:00:00 2001 From: fredrik Date: Mon, 4 Jun 2007 21:59:04 +0000 Subject: [PATCH] Make swcsdup not evalulate its argument twice. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@1064 959494ce-11ee-0310-bf91-de5d638817bd --- include/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/utils.h b/include/utils.h index a1176a6..8cb40dd 100644 --- a/include/utils.h +++ b/include/utils.h @@ -37,7 +37,7 @@ struct wcspair { #define LOGOOM(size) flog(LOG_CRIT, "%s (%s:%i): out of memory (alloc %zi)", __FUNCTION__, __FILE__, __LINE__, (size)) #define smalloc(size) ({void *__result__; ((__result__ = malloc(size)) == NULL)?({LOGOOM((ssize_t)(size)); abort(); (void *)0;}):__result__;}) #define srealloc(ptr, size) ({void *__result__; ((__result__ = realloc((ptr), (size))) == NULL)?({LOGOOM((ssize_t)(size)); abort(); (void *)0;}):__result__;}) -#define swcsdup(wcs) ((wchar_t *)wcscpy(smalloc(sizeof(wchar_t) * (wcslen(wcs) + 1)), (wcs))) +#define swcsdup(wcs) ({wchar_t *__eval__; __eval__ = (wcs); (wchar_t *)wcscpy(smalloc(sizeof(wchar_t) * (wcslen(__eval__) + 1)), __eval__);}) #define sstrdup(str) ((char *)strcpy(smalloc(strlen(str) + 1), (str))) #else #define LOGOOM(size) -- 2.11.0