Skip to content

Commit

Permalink
vector: delete lone argument from get function
Browse files Browse the repository at this point in the history
It's not used for anything since there's no memory allocation.
Makes for a nicer API for the rest of the C code.
  • Loading branch information
matheusmoreira committed Dec 17, 2023
1 parent 3b50929 commit c82728f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/lone/value/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct lone_value lone_vector_create(struct lone_lisp *lone, size_t capacity);

size_t lone_vector_count(struct lone_value vector);
void lone_vector_resize(struct lone_lisp *lone, struct lone_value vector, size_t new_capacity);
struct lone_value lone_vector_get_value_at(struct lone_lisp *lone, struct lone_value vector, size_t i);
struct lone_value lone_vector_get_value_at(struct lone_value vector, size_t i);
struct lone_value lone_vector_get(struct lone_lisp *lone, struct lone_value vector, struct lone_value index);
void lone_vector_set_value_at(struct lone_lisp *lone, struct lone_value vector, size_t i, struct lone_value value);
void lone_vector_set(struct lone_lisp *lone, struct lone_value vector, struct lone_value index, struct lone_value value);
Expand Down
2 changes: 1 addition & 1 deletion source/lone/modules/intrinsic/vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ LONE_PRIMITIVE(vector_slice)
slice = lone_vector_create(lone, j - i);

for (k = 0; i < j; ++i, ++k) {
lone_vector_set_value_at(lone, slice, k, lone_vector_get_value_at(lone, vector, i));
lone_vector_set_value_at(lone, slice, k, lone_vector_get_value_at(vector, i));
}

return slice;
Expand Down
4 changes: 2 additions & 2 deletions source/lone/value/vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void lone_vector_resize(struct lone_lisp *lone, struct lone_value vector, size_t
}
}

struct lone_value lone_vector_get_value_at(struct lone_lisp *lone, struct lone_value vector, size_t i)
struct lone_value lone_vector_get_value_at(struct lone_value vector, size_t i)
{
struct lone_vector *actual;

Expand All @@ -54,7 +54,7 @@ struct lone_value lone_vector_get_value_at(struct lone_lisp *lone, struct lone_v
struct lone_value lone_vector_get(struct lone_lisp *lone, struct lone_value vector, struct lone_value index)
{
if (!lone_is_integer(index)) { /* only integer indexes supported */ linux_exit(-1); }
return lone_vector_get_value_at(lone, vector, index.as.unsigned_integer);
return lone_vector_get_value_at(vector, index.as.unsigned_integer);
}

void lone_vector_set_value_at(struct lone_lisp *lone, struct lone_value vector, size_t i, struct lone_value value)
Expand Down

0 comments on commit c82728f

Please sign in to comment.