Skip to content

Commit

Permalink
ptm/vec: Initialize vector elements to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
obiwac committed Nov 3, 2024
1 parent 9f8f799 commit d7e721d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion flamingo/ptm/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static inline int vec_map(flamingo_t* flamingo, flamingo_val_t* self, flamingo_a
flamingo_val_t* const vec = val_alloc();
vec->kind = FLAMINGO_VAL_KIND_VEC;
vec->vec.count = self->vec.count;
vec->vec.elems = malloc(vec->vec.count * sizeof *vec->vec.elems);
vec->vec.elems = calloc(vec->vec.count, sizeof *vec->vec.elems);
assert(vec->vec.elems != NULL);

for (size_t i = 0; i < vec->vec.count; i++) {
Expand Down
2 changes: 0 additions & 2 deletions tests/call_arg_eval_context.fl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# When calling a function that is defined in a different source file, the context's source could be switched to the source file of the function being called before the argument expressions are evaluated.
# This would cause these evaluations to use the wrong source file.

# TODO rename this

import .tests.call_arg_eval_context_helper

assert function("zonnebloemgranen") == "zonnebloemgranen"

0 comments on commit d7e721d

Please sign in to comment.