Rename LIST_TYPE_NAME to LIST_TYPE
This commit is contained in:
parent
2095580409
commit
fe5c116c17
@ -9,19 +9,19 @@
|
|||||||
#define BASE_LIST_CAPACITY 1024
|
#define BASE_LIST_CAPACITY 1024
|
||||||
|
|
||||||
#define CONCAT(A, B) A##B
|
#define CONCAT(A, B) A##B
|
||||||
#define LIST_TYPE_NAME(T) CONCAT(list_, T)
|
#define LIST_TYPE(T) CONCAT(list_, T)
|
||||||
|
|
||||||
#define MAKE_LIST_TYPE(T) \
|
#define MAKE_LIST_TYPE(T) \
|
||||||
typedef struct { \
|
typedef struct { \
|
||||||
T *items; \
|
T *items; \
|
||||||
u64 capacity; \
|
u64 capacity; \
|
||||||
u64 count; \
|
u64 count; \
|
||||||
} LIST_TYPE_NAME(T)
|
} LIST_TYPE(T)
|
||||||
|
|
||||||
#define list_create(T, ARENA) \
|
#define list_create(T, ARENA) \
|
||||||
(LIST_TYPE_NAME(T) *)_create_list(ARENA, sizeof(T), BASE_LIST_CAPACITY)
|
(LIST_TYPE(T) *)_create_list(ARENA, sizeof(T), BASE_LIST_CAPACITY)
|
||||||
#define list_create_with_capacity(T, ARENA, CAPACITY) \
|
#define list_create_with_capacity(T, ARENA, CAPACITY) \
|
||||||
(LIST_TYPE_NAME(T) *)_create_list(ARENA, sizeof(T), CAPACITY)
|
(LIST_TYPE(T) *)_create_list(ARENA, sizeof(T), CAPACITY)
|
||||||
|
|
||||||
#define _increase_list_capacity(T, ARENA, LP, CAP) \
|
#define _increase_list_capacity(T, ARENA, LP, CAP) \
|
||||||
do { \
|
do { \
|
||||||
@ -59,7 +59,7 @@
|
|||||||
u64 capacity = \
|
u64 capacity = \
|
||||||
new_count < BASE_LIST_CAPACITY ? BASE_LIST_CAPACITY : new_count * 2; \
|
new_count < BASE_LIST_CAPACITY ? BASE_LIST_CAPACITY : new_count * 2; \
|
||||||
\
|
\
|
||||||
DST = (LIST_TYPE_NAME(T) *)_create_list(ARENA, new_count, capacity); \
|
DST = (LIST_TYPE(T) *)_create_list(ARENA, new_count, capacity); \
|
||||||
assert(DST != NULL && "Failed to allocate new list"); \
|
assert(DST != NULL && "Failed to allocate new list"); \
|
||||||
\
|
\
|
||||||
u64 lp1_copy_size = sizeof(T) * LP1->count; \
|
u64 lp1_copy_size = sizeof(T) * LP1->count; \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user