zeroStruct

This commit is contained in:
2025-12-02 14:46:19 +05:00
parent ea6c20f430
commit a57f05cfeb
3 changed files with 5 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ static inline LLNode(T)* LLNode_##T##_createZero(){ \
LLNode(T)* n = (LLNode(T)*)malloc(sizeof(LLNode(T))); \ LLNode(T)* n = (LLNode(T)*)malloc(sizeof(LLNode(T))); \
n->prev = NULL; \ n->prev = NULL; \
n->next = NULL; \ n->next = NULL; \
memset(&n->value, 0, sizeof(T)); \ zeroStruct(&n->value); \
return n; \ return n; \
} \ } \
\ \

View File

@@ -153,4 +153,4 @@ typedef struct Result_ {
}\ }\
} while(0) } while(0)
#define try_assert(EXPR) if(!(EXPR)) { Return RESULT_ERROR(("try_assert(" #EXPR ")"), false); } #define try_assert(EXPR) if(!(EXPR)) { Return RESULT_ERROR(("assertion must be true: " #EXPR), false); }

View File

@@ -76,7 +76,7 @@ typedef void (*Destructor_t)(void* self);
a48,a49,a50,a51,a52,a53,a54,a55, a56,a57,a58,a59,a60,a61,a62,a63, \ a48,a49,a50,a51,a52,a53,a54,a55, a56,a57,a58,a59,a60,a61,a62,a63, \
a64,...) a64 a64,...) a64
// Macro for counting variadic arguments (max 64) // Macro for counting variadic arguments (max 64)
// (see usage in kprint.h) // (see usage in cptr.h)
#define count_args(ARGS...) __count_args(ARGS, \ #define count_args(ARGS...) __count_args(ARGS, \
64,63,62,61,60,59,58,57, 56,55,54,53,52,51,50,49, \ 64,63,62,61,60,59,58,57, 56,55,54,53,52,51,50,49, \
48,47,46,45,44,43,42,41, 40,39,38,37,36,35,34,33, \ 48,47,46,45,44,43,42,41, 40,39,38,37,36,35,34,33, \
@@ -85,6 +85,8 @@ typedef void (*Destructor_t)(void* self);
#define printfe(FORMAT, ...) fprintf(stderr, FORMAT ,##__VA_ARGS__) #define printfe(FORMAT, ...) fprintf(stderr, FORMAT ,##__VA_ARGS__)
#define zeroStruct(STRUCT_PTR) memset((STRUCT_PTR), 0, sizeof(*STRUCT_PTR));
/// @warning pointer can be null /// @warning pointer can be null
#define NULLABLE(NAME) NAME #define NULLABLE(NAME) NAME