-vet flag to do basic vetting of code

This commit is contained in:
gingerBill
2018-11-25 14:14:58 +00:00
parent 41ad896f3f
commit 444f4f446a
7 changed files with 152 additions and 27 deletions
+3 -4
View File
@@ -843,7 +843,6 @@ fmt_bit_set :: proc(fi: ^Fmt_Info, v: any, name: string = "") {
case runtime.Type_Info_Bit_Set:
bits: u64;
bit_size := u64(8*type_info.size);
verb := 'b';
switch bit_size {
case 0: bits = 0;
@@ -886,7 +885,7 @@ fmt_bit_set :: proc(fi: ^Fmt_Info, v: any, name: string = "") {
}
}
}
fmt_bit_field :: proc(fi: ^Fmt_Info, v: any, name: string = "") {
fmt_bit_field :: proc(fi: ^Fmt_Info, v: any, bit_field_name: string = "") {
type_info := type_info_of(v.id);
switch info in type_info.variant {
case runtime.Type_Info_Named:
@@ -902,8 +901,8 @@ fmt_bit_field :: proc(fi: ^Fmt_Info, v: any, name: string = "") {
case 8: data = cast(u64)(^u64)(v.data)^;
}
if name != "" {
write_string(fi.buf, name);
if bit_field_name != "" {
write_string(fi.buf, bit_field_name);
write_byte(fi.buf, '{');
} else {
write_string(fi.buf, "bit_field{");
+2 -2
View File
@@ -226,9 +226,9 @@ scratch_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
case Allocator_Mode.Free:
last_ptr := rawptr(&scratch.data[scratch.prev_offset]);
if old_memory == last_ptr {
size := scratch.curr_offset - scratch.prev_offset;
full_size := scratch.curr_offset - scratch.prev_offset;
scratch.curr_offset = scratch.prev_offset;
zero(last_ptr, size);
zero(last_ptr, full_size);
return nil;
}
// NOTE(bill): It's scratch memory, don't worry about freeing