From 2d5bcbcba2e66a3085eeee1a568a356f6c881f4a Mon Sep 17 00:00:00 2001 From: Matheus Afonso Martins Moreira Date: Fri, 15 Dec 2023 09:46:41 -0300 Subject: [PATCH] table: use boolean type instead of integer type A remnant from the early days where I did not include stdbool.h. --- source/lone/value/table.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/lone/value/table.c b/source/lone/value/table.c index 94d9c492..bbd7210d 100644 --- a/source/lone/value/table.c +++ b/source/lone/value/table.c @@ -45,19 +45,19 @@ static size_t lone_table_entry_find_index_for(struct lone_lisp *lone, struct lon return i; } -static int lone_table_entry_set(struct lone_lisp *lone, struct lone_table_index *indexes, struct lone_table_entry *entries, size_t capacity, size_t index_if_new_entry, struct lone_value key, struct lone_value value) +static bool lone_table_entry_set(struct lone_lisp *lone, struct lone_table_index *indexes, struct lone_table_entry *entries, size_t capacity, size_t index_if_new_entry, struct lone_value key, struct lone_value value) { size_t i = lone_table_entry_find_index_for(lone, key, indexes, entries, capacity); if (indexes[i].used) { entries[indexes[i].index].value = value; - return 0; + return false; } else { indexes[i].used = true; indexes[i].index = index_if_new_entry; entries[indexes[i].index].key = key; entries[indexes[i].index].value = value; - return 1; + return true; } } @@ -102,7 +102,7 @@ static void lone_table_resize(struct lone_lisp *lone, struct lone_value table, s void lone_table_set(struct lone_lisp *lone, struct lone_value table, struct lone_value key, struct lone_value value) { struct lone_heap_value *actual; - int is_new_table_entry; + bool is_new_table_entry; actual = table.as.heap_value;