commit cd292c73dd8b6a746eb45b8f4026240442026e98 from: Omar Polo via: Thomas Adam date: Mon Dec 18 21:54:36 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 - dcbbf1970c792afd614fc4cb98e93b84de685c95 commit + cd292c73dd8b6a746eb45b8f4026240442026e98 blob - cd54d978b00a77d8fdf24eb9ad54a78c4a1819ab blob + bedeb4baba587c7ff5074b8f25ccf65f1ce1e9b6 --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -575,7 +575,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 - 6ea1d90bca9cc05ffc240c807b165680feb3f72a blob + c6f6315c469836e4424a9d92b00e6adf8fe10965 --- gotwebd/gotwebd.h +++ gotwebd/gotwebd.h @@ -444,7 +444,6 @@ enum query_actions { TAGS, TREE, RSS, - ACTIONS__MAX, }; extern struct gotwebd *gotwebd_env;