From 1a0886d852bb8a0d9428dc6f54c1e503d06073a0 Mon Sep 17 00:00:00 2001 From: Oxore Date: Sun, 28 Jul 2019 21:23:27 +0300 Subject: Refactor idlist, move all global vars to local scope - Replace list_foreach with LIST_FOREACH macro. - Remove `game` global variable and make it local everywhere. - Move global vars `fld`, `nxt` and `texts` into `game` struct. - Add `static` qualifier to engine.c's specific global vars. - Move `sfRenderWindow window` global var to local scope --- include/idlist.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/idlist.h') diff --git a/include/idlist.h b/include/idlist.h index c006a32..6d09e16 100644 --- a/include/idlist.h +++ b/include/idlist.h @@ -18,5 +18,7 @@ struct idlist *list_new(); struct idlist *list_append(struct idlist *list); struct idlist *list_get(const struct idlist *list, size_t id); void list_rm_node(struct idlist *node); -void list_foreach(struct idlist *list, void (*job)(void *)); void list_destroy(struct idlist *list); + +#define LIST_FOREACH(head, e) \ + for (struct idlist *e = head; e; e = e->next) -- cgit v1.2.3