mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Use gb_zero_* calls
This commit is contained in:
+3
-3
@@ -658,7 +658,7 @@ gb_internal bool check_vet_shadowing(Checker *c, Entity *e, VettedEntity *ve) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zero_item(ve);
|
gb_zero_item(ve);
|
||||||
ve->kind = VettedEntity_Shadowed;
|
ve->kind = VettedEntity_Shadowed;
|
||||||
ve->entity = e;
|
ve->entity = e;
|
||||||
ve->other = shadowed;
|
ve->other = shadowed;
|
||||||
@@ -677,7 +677,7 @@ gb_internal bool check_vet_unused(Checker *c, Entity *e, VettedEntity *ve) {
|
|||||||
}
|
}
|
||||||
case Entity_ImportName:
|
case Entity_ImportName:
|
||||||
case Entity_LibraryName:
|
case Entity_LibraryName:
|
||||||
zero_item(ve);
|
gb_zero_item(ve);
|
||||||
ve->kind = VettedEntity_Unused;
|
ve->kind = VettedEntity_Unused;
|
||||||
ve->entity = e;
|
ve->entity = e;
|
||||||
return true;
|
return true;
|
||||||
@@ -1389,7 +1389,7 @@ gb_internal void reset_checker_context(CheckerContext *ctx, AstFile *file, Untyp
|
|||||||
auto type_path = ctx->type_path;
|
auto type_path = ctx->type_path;
|
||||||
array_clear(type_path);
|
array_clear(type_path);
|
||||||
|
|
||||||
zero_size(&ctx->pkg, gb_size_of(CheckerContext) - gb_offset_of(CheckerContext, pkg));
|
gb_zero_size(&ctx->pkg, gb_size_of(CheckerContext) - gb_offset_of(CheckerContext, pkg));
|
||||||
|
|
||||||
ctx->file = nullptr;
|
ctx->file = nullptr;
|
||||||
ctx->scope = builtin_pkg->scope;
|
ctx->scope = builtin_pkg->scope;
|
||||||
|
|||||||
@@ -2,13 +2,6 @@
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gb_internal gb_inline void zero_size(void *ptr, isize len) {
|
|
||||||
memset(ptr, 0, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define zero_item(ptr) zero_size((ptr), gb_size_of(ptr))
|
|
||||||
|
|
||||||
|
|
||||||
template <typename U, typename V>
|
template <typename U, typename V>
|
||||||
gb_internal gb_inline U bit_cast(V &v) { return reinterpret_cast<U &>(v); }
|
gb_internal gb_inline U bit_cast(V &v) { return reinterpret_cast<U &>(v); }
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2534,7 +2534,7 @@ gb_inline void const *gb_pointer_add_const(void const *ptr, isize bytes) {
|
|||||||
gb_inline void const *gb_pointer_sub_const(void const *ptr, isize bytes) { return cast(void const *)(cast(u8 const *)ptr - bytes); }
|
gb_inline void const *gb_pointer_sub_const(void const *ptr, isize bytes) { return cast(void const *)(cast(u8 const *)ptr - bytes); }
|
||||||
gb_inline isize gb_pointer_diff (void const *begin, void const *end) { return cast(isize)(cast(u8 const *)end - cast(u8 const *)begin); }
|
gb_inline isize gb_pointer_diff (void const *begin, void const *end) { return cast(isize)(cast(u8 const *)end - cast(u8 const *)begin); }
|
||||||
|
|
||||||
gb_inline void gb_zero_size(void *ptr, isize size) { gb_memset(ptr, 0, size); }
|
gb_inline void gb_zero_size(void *ptr, isize size) { memset(ptr, 0, size); }
|
||||||
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
|||||||
+1
-1
@@ -5413,7 +5413,7 @@ gb_internal ParseFileError init_ast_file(AstFile *f, String const &fullpath, Tok
|
|||||||
if (!string_ends_with(f->fullpath, str_lit(".odin"))) {
|
if (!string_ends_with(f->fullpath, str_lit(".odin"))) {
|
||||||
return ParseFile_WrongExtension;
|
return ParseFile_WrongExtension;
|
||||||
}
|
}
|
||||||
zero_item(&f->tokenizer);
|
gb_zero_item(&f->tokenizer);
|
||||||
f->tokenizer.curr_file_id = f->id;
|
f->tokenizer.curr_file_id = f->id;
|
||||||
|
|
||||||
TokenizerInitError err = init_tokenizer_from_fullpath(&f->tokenizer, f->fullpath, build_context.copy_file_contents);
|
TokenizerInitError err = init_tokenizer_from_fullpath(&f->tokenizer, f->fullpath, build_context.copy_file_contents);
|
||||||
|
|||||||
+1
-1
@@ -964,7 +964,7 @@ gb_internal Type *alloc_type(TypeKind kind) {
|
|||||||
// gbAllocator a = heap_allocator();
|
// gbAllocator a = heap_allocator();
|
||||||
gbAllocator a = permanent_allocator();
|
gbAllocator a = permanent_allocator();
|
||||||
Type *t = gb_alloc_item(a, Type);
|
Type *t = gb_alloc_item(a, Type);
|
||||||
zero_item(t);
|
gb_zero_item(t);
|
||||||
t->kind = kind;
|
t->kind = kind;
|
||||||
t->cached_size = -1;
|
t->cached_size = -1;
|
||||||
t->cached_align = -1;
|
t->cached_align = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user