~sircmpwn/harec unlisted

c6fce7c3d077f81d94c272f633bb16c74a6eb963 — Eyal Sawady a month ago c20949d
Disallow assignment from *void a nullable pointer

Signed-off-by: Eyal Sawady <ecs@d2evs.net>
3 files changed, 4 insertions(+), 4 deletions(-)

M rt/ensure.ha
M rt/malloc.ha
M src/types.c
M rt/ensure.ha => rt/ensure.ha +1 -1
@@ 1,5 1,5 @@
export type slice = struct {
	data: *void,
	data: nullable *void,
	length: size,
	capacity: size,
};

M rt/malloc.ha => rt/malloc.ha +2 -2
@@ 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

M src/types.c => src/types.c +1 -1
@@ 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;