replace leading _ for private symbols with keyword hide
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
mem :: import "@std/mem"
|
||||
|
||||
_probe_count func(context ?*mut anyopaque) void {
|
||||
hide probe_count func(context ?*mut anyopaque) void {
|
||||
if context |raw| {
|
||||
counts *mut usize :: ptrcast!(usize, raw)
|
||||
counts[0] += 1
|
||||
}
|
||||
}
|
||||
|
||||
_probe_alloc func(context ?*mut anyopaque, _ usize, _ usize) ?*mut u8 {
|
||||
_probe_count(context)
|
||||
hide probe_alloc func(context ?*mut anyopaque, _ usize, _ usize) ?*mut u8 {
|
||||
probe_count(context)
|
||||
return none
|
||||
}
|
||||
|
||||
_probe_realloc func(context ?*mut anyopaque, _ ?*mut u8, _ usize, _ usize, _ usize) ?*mut u8 {
|
||||
_probe_count(context)
|
||||
hide probe_realloc func(context ?*mut anyopaque, _ ?*mut u8, _ usize, _ usize, _ usize) ?*mut u8 {
|
||||
probe_count(context)
|
||||
return none
|
||||
}
|
||||
|
||||
_probe_free func(context ?*mut anyopaque, _ ?*mut u8, _ usize, _ usize) void {
|
||||
_probe_count(context)
|
||||
hide probe_free func(context ?*mut anyopaque, _ ?*mut u8, _ usize, _ usize) void {
|
||||
probe_count(context)
|
||||
}
|
||||
|
||||
_probe_vtable mem.AllocatorVTable :: mem.AllocatorVTable {
|
||||
alloc = _probe_alloc,
|
||||
realloc = _probe_realloc,
|
||||
free = _probe_free,
|
||||
hide probe_vtable mem.AllocatorVTable :: mem.AllocatorVTable {
|
||||
alloc = probe_alloc,
|
||||
realloc = probe_realloc,
|
||||
free = probe_free,
|
||||
}
|
||||
|
||||
typed_allocator_test func() i32 {
|
||||
@@ -34,11 +34,11 @@ typed_allocator_test func() i32 {
|
||||
second_calls [1]mut usize = [0]
|
||||
first_allocator mem.Allocator :: mem.Allocator {
|
||||
context = (&first_calls).ptr,
|
||||
vtable = &_probe_vtable,
|
||||
vtable = &probe_vtable,
|
||||
}
|
||||
second_allocator mem.Allocator :: mem.Allocator {
|
||||
context = (&second_calls).ptr,
|
||||
vtable = &_probe_vtable,
|
||||
vtable = &probe_vtable,
|
||||
}
|
||||
|
||||
_ = mem.raw_alloc(first_allocator, 1, 1)
|
||||
|
||||
Reference in New Issue
Block a user