mirror of
https://github.com/Ed94/metadesk.git
synced 2026-06-13 07:52:22 -07:00
oops; also add zero-allocator macro
This commit is contained in:
+6
-1
@@ -579,6 +579,11 @@ MD_FUNCTION void MD_MemoryCopy(void *dst, void *src, MD_u64 size);
|
||||
|
||||
MD_FUNCTION void* MD_AllocZero(MD_u64 size);
|
||||
#define MD_PushArray(T,c) (T*)MD_AllocZero(sizeof(T)*(c))
|
||||
// NOTE(rjf): Right now, both calls just automatically zero their memory,
|
||||
// but I'm explicitly splitting this out to ensure that we don't accidentally
|
||||
// assume that we have zeroed memory incorrectly in the future (when our
|
||||
// allocation approach changes).
|
||||
#define MD_PushArrayZero(T,c) (T*)MD_AllocZero(sizeof(T)*(c))
|
||||
|
||||
//~ Characters
|
||||
MD_FUNCTION MD_b32 MD_CharIsAlpha(MD_u8 c);
|
||||
@@ -664,7 +669,7 @@ MD_FUNCTION MD_MapSlot* MD_MapOverwrite(MD_Map *map, MD_MapKey key, void *val);
|
||||
|
||||
//~ Parsing
|
||||
|
||||
MD_FUNCTION_IMPL MD_NodeFlags MD_NodeFlagsFromTokenKind(MD_TokenKind kind);
|
||||
MD_FUNCTION MD_NodeFlags MD_NodeFlagsFromTokenKind(MD_TokenKind kind);
|
||||
|
||||
MD_FUNCTION MD_b32 MD_TokenKindIsWhitespace(MD_TokenKind kind);
|
||||
MD_FUNCTION MD_b32 MD_TokenKindIsComment(MD_TokenKind kind);
|
||||
|
||||
+1
-3
@@ -942,9 +942,7 @@ MD_MapMakeBucketCount(MD_u64 bucket_count){
|
||||
// make most sense with a parameter
|
||||
MD_Map result = {0};
|
||||
result.bucket_count = bucket_count;
|
||||
// TODO(allen): push array zero
|
||||
result.buckets = MD_PushArray(MD_MapBucket, bucket_count);
|
||||
memset(result.buckets, 0, sizeof(*result.buckets)*bucket_count);
|
||||
result.buckets = MD_PushArrayZero(MD_MapBucket, bucket_count);
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user