commit 0c6bdfca5ba9050d77d0984aee14f03aabd64bfc from: Omar Polo date: Mon Dec 18 12:02:57 2023 UTC gotwebd: use nitems() instead of ACTIONS__MAX I feel safer by using the explicit size of the table rather than an hypothetical maximum value given by the enum. Mostly because in the past I edited a table and forgot to remove the corresponding enum value. ok stsp@ commit - dc1262366a5757445d677443efb3077f4bcf3c29 commit + 0c6bdfca5ba9050d77d0984aee14f03aabd64bfc blob - be9adb8b334860eb82e321e678c1778977d97754 blob + 58518b3acbe68a45a2d45866c315ef15fa7b8a40 --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -576,7 +576,7 @@ gotweb_assign_querystring(struct querystring **qs, cha switch (querystring_keys[el_cnt].element) { case ACTION: - for (a_cnt = 0; a_cnt < ACTIONS__MAX; a_cnt++) { + for (a_cnt = 0; a_cnt < nitems(action_keys); a_cnt++) { if (strcmp(value, action_keys[a_cnt].name) != 0) continue; else if (strcmp(value, blob - e3fd4407e26812d1c9cfc32955e1a5d603f4a1a9 blob + 10e6fc3016b6d24b44b9fc556d0509f124f4c761 --- gotwebd/gotwebd.h +++ gotwebd/gotwebd.h @@ -442,7 +442,6 @@ enum query_actions { TAGS, TREE, RSS, - ACTIONS__MAX, }; extern struct gotwebd *gotwebd_env;