rename none to null

This commit is contained in:
2026-07-21 22:59:51 +02:00
parent 1619ea98a3
commit 402871ef7a
44 changed files with 3771 additions and 3767 deletions
+2 -2
View File
@@ -38,7 +38,7 @@ Ball :: struct {
}
# A frame's worth of player intent, as a tagged union. Each arm carries exactly
# the data that action needs (or `void` when it needs none).
# the data that action needs (or `void` when it needs null).
Command :: union(enum) {
spawn Vector2 # spawn a shape at this point
push struct { dx f32, dy f32 } # blow every shape this way
@@ -211,7 +211,7 @@ main func() i32 {
sel :: for 0..(count) |i| blk: {
c Vector2 = Vector2{ x = balls[i].x, y = balls[i].y }
if CheckCollisionPointCircle(mouse, c, balls[i].radius) yield :blk i
yield none
yield null
}
# --- draw -----------------------------------------------------------
+1 -1
View File
@@ -116,7 +116,7 @@ hide system_vtable IoVTable :: IoVTable {
hide system func() Io {
return Io {
context = none,
context = null,
vtable = &system_vtable,
}
}
+9 -9
View File
@@ -90,7 +90,7 @@ realloc func($T type, allocator Allocator, memory []mut T, new_count usize) []mu
return .out_of_memory
}
old_memory ?*mut u8 = none
old_memory ?*mut u8 = null
old_size usize = 0
if memory.len != 0 {
old_memory = ptrcast!(u8, memory.ptr)
@@ -137,17 +137,17 @@ hide power_of_two func(value usize) bool {
hide c_alloc func(_ ?*mut anyopaque, size usize, alignment usize) ?*mut u8 {
if power_of_two(alignment) == false {
return none
return null
}
if alignment <= malloc_alignment {
return ptrcast!(u8, c.malloc(c_ulong(size)))
}
memory [1]mut ?*mut anyopaque = [none]
memory [1]mut ?*mut anyopaque = [null]
status c_int = c.posix_memalign((&memory).ptr, c_ulong(alignment), c_ulong(size))
if status != 0 {
return none
return null
}
return ptrcast!(u8, memory[0])
@@ -155,12 +155,12 @@ hide c_alloc func(_ ?*mut anyopaque, size usize, alignment usize) ?*mut u8 {
hide c_realloc func(_ ?*mut anyopaque, memory ?*mut u8, old_size usize, new_size usize, alignment usize) ?*mut u8 {
if power_of_two(alignment) == false {
return none
return null
}
if new_size == 0 {
c.free(memory)
return none
return null
}
if memory |old_memory| {
@@ -168,7 +168,7 @@ hide c_realloc func(_ ?*mut anyopaque, memory ?*mut u8, old_size usize, new_size
return ptrcast!(u8, c.realloc(old_memory, c_ulong(new_size)))
}
new_memory ?*mut u8 = c_alloc(none, new_size, alignment)
new_memory ?*mut u8 = c_alloc(null, new_size, alignment)
if new_memory |new_bytes| {
copy_size usize = old_size
if new_size < copy_size {
@@ -183,7 +183,7 @@ hide c_realloc func(_ ?*mut anyopaque, memory ?*mut u8, old_size usize, new_size
return new_memory
}
return c_alloc(none, new_size, alignment)
return c_alloc(null, new_size, alignment)
}
hide c_free func(_ ?*mut anyopaque, memory ?*mut u8, _ usize, _ usize) void {
@@ -197,6 +197,6 @@ hide c_vtable AllocatorVTable :: AllocatorVTable {
}
c_allocator Allocator :: Allocator {
context = none,
context = null,
vtable = &c_vtable,
}
+1 -1
View File
@@ -42,7 +42,7 @@ apply_decay func(players []mut Player) void {
}
best_player func(players []mut Player) ?@mut Player {
best ?@mut Player = none
best ?@mut Player = null
best_score i32 = 0
for players |@player| {
+8 -8
View File
@@ -82,17 +82,17 @@ hide power_of_two func(value usize) bool {
hide c_alloc func(_ ?*mut anyopaque, size usize, alignment usize) ?*mut u8 {
if power_of_two(alignment) == false {
return none
return null
}
if alignment <= malloc_alignment {
return ptrcast!(u8, c.malloc(c_ulong(size)))
}
memory [1]mut ?*mut anyopaque = [none]
memory [1]mut ?*mut anyopaque = [null]
status c_int = c.posix_memalign((&memory).ptr, c_ulong(alignment), c_ulong(size))
if status != 0 {
return none
return null
}
return ptrcast!(u8, memory[0])
@@ -100,12 +100,12 @@ hide c_alloc func(_ ?*mut anyopaque, size usize, alignment usize) ?*mut u8 {
hide c_realloc func(_ ?*mut anyopaque, memory ?*mut u8, old_size usize, new_size usize, alignment usize) ?*mut u8 {
if power_of_two(alignment) == false {
return none
return null
}
if new_size == 0 {
c.free(memory)
return none
return null
}
if memory |old_memory| {
@@ -113,7 +113,7 @@ hide c_realloc func(_ ?*mut anyopaque, memory ?*mut u8, old_size usize, new_size
return ptrcast!(u8, c.realloc(old_memory, c_ulong(new_size)))
}
new_memory ?*mut u8 = c_alloc(none, new_size, alignment)
new_memory ?*mut u8 = c_alloc(null, new_size, alignment)
if new_memory |new_bytes| {
copy_size usize = old_size
if new_size < copy_size {
@@ -128,7 +128,7 @@ hide c_realloc func(_ ?*mut anyopaque, memory ?*mut u8, old_size usize, new_size
return new_memory
}
return c_alloc(none, new_size, alignment)
return c_alloc(null, new_size, alignment)
}
hide c_free func(_ ?*mut anyopaque, memory ?*mut u8, _ usize, _ usize) void {
@@ -142,6 +142,6 @@ hide c_vtable AllocatorVTable :: AllocatorVTable {
}
c_allocator Allocator :: Allocator {
context = none,
context = null,
vtable = &c_vtable,
}