diff options
| author | Tyge Løvset <[email protected]> | 2023-07-07 16:23:35 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-07-07 16:23:35 +0200 |
| commit | d8c1a999cc566b8943003ad5281abc6eefcda519 (patch) | |
| tree | 0d0c4c530276fcb0e89207eb630e6455b779d1ff | |
| parent | e63a3dd6545261f5236a3d7e1c2be6571871b689 (diff) | |
| download | STC-modified-d8c1a999cc566b8943003ad5281abc6eefcda519.tar.gz STC-modified-d8c1a999cc566b8943003ad5281abc6eefcda519.zip | |
Issue #60: fixed compiler compability.
| -rw-r--r-- | include/stc/ccommon.h | 4 | ||||
| -rw-r--r-- | misc/examples/intrusive.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index bbf1579b..63ce5b09 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -69,8 +69,8 @@ #define c_LITERAL(T) T #else #define _i_alloc(T) ((T*)i_malloc(c_sizeof(T))) - #define _i_new(T, ...) ((T*)memcpy(_i_alloc(T), (T[]){__VA_ARGS__}, sizeof(T))) - #define c_new(T, ...) ((T*)memcpy(malloc(sizeof(T)), (T[]){__VA_ARGS__}, sizeof(T))) + #define _i_new(T, ...) ((T*)memcpy(_i_alloc(T), ((T[]){__VA_ARGS__}), sizeof(T))) + #define c_new(T, ...) ((T*)memcpy(malloc(sizeof(T)), ((T[]){__VA_ARGS__}), sizeof(T))) #define c_LITERAL(T) (T) #endif #define c_malloc(sz) malloc(c_i2u(sz)) diff --git a/misc/examples/intrusive.c b/misc/examples/intrusive.c index 0d59c5ab..e3939f4e 100644 --- a/misc/examples/intrusive.c +++ b/misc/examples/intrusive.c @@ -17,7 +17,7 @@ void printList(List list) { int main() { List list = {0}; c_forlist (i, int, {6, 9, 3, 1, 7, 4, 5, 2, 8}) - List_push_back_node(&list, c_new(List_node, {.value=*i.ref})); + List_push_back_node(&list, c_new(List_node, {0, *i.ref})); printList(list); |
