switch aa {
case .Alloc {
- data.set->insert(newptr);
+ if newptr != null {
+ data.set->insert(newptr);
+ }
}
case .Resize {
data.set->remove(oldptr);
- data.set->insert(newptr);
+
+ if newptr != null {
+ data.set->insert(newptr);
+ }
}
case .Free {
#if runtime.Multi_Threading_Enabled do sync.scoped_mutex(^heap_mutex);
hb_ptr := cast(^heap_freed_block) (cast(uintptr) ptr - sizeof heap_allocated_block);
- #if Enable_Debug do assert(hb_ptr.size & Allocated_Flag == Allocated_Flag, "Corrupted heap on free. This could be due to a double free, or using memory past were you allocated it.");
+ #if Enable_Debug {
+ // assert(hb_ptr.size & Allocated_Flag == Allocated_Flag, "Corrupted heap on free. This could be due to a double free, or using memory past were you allocated it.");
+
+ if hb_ptr.size & Allocated_Flag != Allocated_Flag {
+ log("INVALID DOUBLE FREE");
+ return;
+ }
+ }
hb_ptr.size &= ~Allocated_Flag;
orig_size := hb_ptr.size - sizeof heap_allocated_block;
#thread_local context : OnyxContext;
assert :: (cond: bool, msg: str, site := #callsite) {
- if !cond do context.assert_handler(msg, site);
+ if !cond {
+ context.assert_handler(msg, site);
+ }
}
} else {
out.count = i;
- s.data += out.count + (upto.count - 1);
- s.count -= out.count + (upto.count - 1);
+ s.data += out.count;
+ s.count -= out.count;
}
return out;
syn match onyxCall "\<[a-zA-Z_][a-zA-Z0-9_\.]*\>" contained
syn match onyxDirective "\#[a-zA-Z_]\+"
+syn match onyxTag "@.\+$"
syn region onyxString display start=+"+ skip=+\\\\\|\\"+ end=+"+ keepend
hi def link onyxDefinition Identifier
hi def link onyxCall Function
hi def link onyxOperator Operator
+hi def link onyxTag Constant
let b:current_syntax = "onyx"
let &cpo = s:cpo_save