Skip to content

Commit

Permalink
Merge pull request #300 from ChinYikMing/pr
Browse files Browse the repository at this point in the history
Refactor with macro ARRAYS_SIZE
  • Loading branch information
jserv authored Dec 21, 2023
2 parents b3e2809 + 953d685 commit 7a5288f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static inline state_t *state_new(void)

s->fd_map = map_init(int, FILE *, map_cmp_int);
FILE *files[] = {stdin, stdout, stderr};
for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++)
for (size_t i = 0; i < ARRAYS_SIZE(files); i++)
map_insert(s->fd_map, &i, &files[i]);

return s;
Expand Down

0 comments on commit 7a5288f

Please sign in to comment.