mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-16 16:14:06 +00:00
Use gb_zero_* calls
This commit is contained in:
@@ -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->entity = e;
|
||||
ve->other = shadowed;
|
||||
@@ -677,7 +677,7 @@ gb_internal bool check_vet_unused(Checker *c, Entity *e, VettedEntity *ve) {
|
||||
}
|
||||
case Entity_ImportName:
|
||||
case Entity_LibraryName:
|
||||
zero_item(ve);
|
||||
gb_zero_item(ve);
|
||||
ve->kind = VettedEntity_Unused;
|
||||
ve->entity = e;
|
||||
return true;
|
||||
@@ -1389,7 +1389,7 @@ gb_internal void reset_checker_context(CheckerContext *ctx, AstFile *file, Untyp
|
||||
auto type_path = ctx->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->scope = builtin_pkg->scope;
|
||||
|
||||
@@ -2,13 +2,6 @@
|
||||
#include <malloc.h>
|
||||
#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>
|
||||
gb_internal gb_inline U bit_cast(V &v) { return reinterpret_cast<U &>(v); }
|
||||
|
||||
|
||||
@@ -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 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__)
|
||||
|
||||
@@ -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"))) {
|
||||
return ParseFile_WrongExtension;
|
||||
}
|
||||
zero_item(&f->tokenizer);
|
||||
gb_zero_item(&f->tokenizer);
|
||||
f->tokenizer.curr_file_id = f->id;
|
||||
|
||||
TokenizerInitError err = init_tokenizer_from_fullpath(&f->tokenizer, f->fullpath, build_context.copy_file_contents);
|
||||
|
||||
@@ -964,7 +964,7 @@ gb_internal Type *alloc_type(TypeKind kind) {
|
||||
// gbAllocator a = heap_allocator();
|
||||
gbAllocator a = permanent_allocator();
|
||||
Type *t = gb_alloc_item(a, Type);
|
||||
zero_item(t);
|
||||
gb_zero_item(t);
|
||||
t->kind = kind;
|
||||
t->cached_size = -1;
|
||||
t->cached_align = -1;
|
||||
|
||||
Reference in New Issue
Block a user