diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-10-01 12:43:00 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-10-01 12:43:00 -0400 |
| commit | 6583fe9b389a6b4698f9364945885e6783506886 (patch) | |
| tree | 0464456d177eab051b03f29a74218a45b301f174 /src/stdlib/pointers.c | |
| parent | 0cfae753aa131f949253f3fba1e3a36c2bde6ac0 (diff) | |
Convert to using more zero values for `none`
Diffstat (limited to 'src/stdlib/pointers.c')
| -rw-r--r-- | src/stdlib/pointers.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/stdlib/pointers.c b/src/stdlib/pointers.c index 0a1623a0..74037613 100644 --- a/src/stdlib/pointers.c +++ b/src/stdlib/pointers.c @@ -30,7 +30,7 @@ Text_t Pointer$as_text(const void *x, bool colorize, const TypeInfo_t *type) { } static const void *root = NULL; - static Table_t pending = {}; + static Table_t pending = EMPTY_TABLE; bool top_level = (root == NULL); // Check for recursive references, so if `x.foo = x`, then it prints as @@ -47,7 +47,7 @@ Text_t Pointer$as_text(const void *x, bool colorize, const TypeInfo_t *type) { Text_t text = Texts(Text$from_str(ptr_info.sigil), Int64$value_as_text(*id)); return colorize ? Texts(Text("\x1b[34;1m"), text, Text("\x1b[m")) : text; } - int64_t next_id = pending.entries.length + 2; + int64_t next_id = (int64_t)pending.entries.length + 2; Table$set(&pending, x, &next_id, &rec_table); } @@ -97,7 +97,7 @@ void Pointer$serialize(const void *obj, FILE *out, Table_t *pointers, const Type if (id_ptr) { id = *id_ptr; } else { - id = pointers->entries.length + 1; + id = (int64_t)pointers->entries.length + 1; Table$set(pointers, &ptr, &id, &ptr_to_int_table); } @@ -112,7 +112,7 @@ void Pointer$deserialize(FILE *in, void *outval, List_t *pointers, const TypeInf Int64$deserialize(in, &id, pointers, &Int64$info); assert(id != 0); - if (id > pointers->length) { + if (id > (int64_t)pointers->length) { void *obj = GC_MALLOC((size_t)type->PointerInfo.pointed->size); List$insert(pointers, &obj, I(0), sizeof(void *)); _deserialize(in, obj, pointers, type->PointerInfo.pointed); |
