From c8278d5437ac51ce1d63327fee6296035d80fe20 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Mon, 8 Nov 2021 08:06:55 +0100 Subject: Third trial. --- include/stc/ccommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index 06ccfc04..9359414c 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -77,13 +77,13 @@ # define c_new(T) c_malloc(sizeof(T)) # define c_new_n(T, n) c_malloc(sizeof(T)*(n)) # define c_make(T) (T) -# define c_make_ptr(T, value) memcpy(c_new(T), &(T){value}, sizeof(T)) +# define c_make_ptr(T, ...) memcpy(c_new(T), (T[]){__VA_ARGS__}, sizeof(T)) #else # include # define c_new(T) static_cast(c_malloc(sizeof(T))) # define c_new_n(T, n) static_cast(c_malloc(sizeof(T)*(n))) # define c_make(T) T -# define c_make_ptr(T, value) new (c_new(T)) T{value} +# define c_make_ptr(T, ...) new (c_new(T)) T{__VA_ARGS__} #endif #ifndef c_malloc # define c_malloc(sz) malloc(sz) -- cgit v1.2.3