From 953d685c961b45ab0b1dc5702cd601c86ca09c18 Mon Sep 17 00:00:00 2001 From: ChinYikMing Date: Thu, 21 Dec 2023 18:04:47 +0800 Subject: [PATCH] Refactor with macro ARRAYS_SIZE --- src/state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/state.h b/src/state.h index c655b233..981b471b 100644 --- a/src/state.h +++ b/src/state.h @@ -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;