Skip to content

Commit

Permalink
table: use boolean type instead of integer type
Browse files Browse the repository at this point in the history
A remnant from the early days where I did not include stdbool.h.
  • Loading branch information
matheusmoreira committed Dec 15, 2023
1 parent 3ce494b commit 2d5bcbc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/lone/value/table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 2d5bcbc

Please sign in to comment.