harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c6fce7c3d077f81d94c272f633bb16c74a6eb963
parent c20949d002c58a4b98e8f8120f087f2df7675fd5
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Thu,  6 May 2021 13:34:50 -0400

Disallow assignment from *void a nullable pointer

Signed-off-by: Eyal Sawady <ecs@d2evs.net>

Diffstat:
Mrt/ensure.ha | 2+-
Mrt/malloc.ha | 4++--
Msrc/types.c | 2+-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/rt/ensure.ha b/rt/ensure.ha @@ -1,5 +1,5 @@ export type slice = struct { - data: *void, + data: nullable *void, length: size, capacity: size, }; diff --git a/rt/malloc.ha b/rt/malloc.ha @@ -133,8 +133,8 @@ fn free_large(_p: *void, s: size) void = { fn free_small(p: *void, s: size) void = { let b = size2bin(s); let q = bins[b]; - *(p: **void) = q; - bins[b] = p: nullable *void; + *(p: *nullable *void) = q; + bins[b] = p; }; // Changes the allocation size of a pointer to n bytes. If n is smaller than diff --git a/src/types.c b/src/types.c @@ -572,7 +572,7 @@ type_is_assignable(const struct type *to, const struct type *from) from_secondary = strip_flags(from_secondary, &_from_secondary); switch (to_secondary->storage) { case STORAGE_VOID: - return true; + break; case STORAGE_ARRAY: if (type_is_assignable(to_secondary, from_secondary)) { return true;