aboutsummaryrefslogtreecommitdiff
path: root/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-15 07:50:34 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-15 07:50:34 +0000
commitca617d679ff296a4abe0e7526d8e8cab4f87e338 (patch)
treec854ff73d8b545170ef71d2966524dcbd946720a /status.c
parent615d85fb23e8eea75d3c630eccc21e98dd8a8ec7 (diff)
downloadrtmux-ca617d679ff296a4abe0e7526d8e8cab4f87e338.tar.gz
rtmux-ca617d679ff296a4abe0e7526d8e8cab4f87e338.tar.bz2
rtmux-ca617d679ff296a4abe0e7526d8e8cab4f87e338.zip
Having to update NSETOPTION/NSETWINDOWOPTION when adding new options is a bit
annoying and it is only use for iterating, so use a sentinel to mark the end of each array instead. Different fix for a problem pointed out by Kalle Olavi Niemitalo.
Diffstat (limited to 'status.c')
-rw-r--r--status.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/status.c b/status.c
index 60d7799c..89a83cba 100644
--- a/status.c
+++ b/status.c
@@ -898,7 +898,7 @@ status_prompt_complete(const char *s)
const struct set_option_entry *optent;
ARRAY_DECL(, const char *) list;
char *prefix, *s2;
- u_int i;
+ u_int i;
size_t j;
if (*s == '\0')
@@ -910,13 +910,11 @@ status_prompt_complete(const char *s)
if (strncmp((*cmdent)->name, s, strlen(s)) == 0)
ARRAY_ADD(&list, (*cmdent)->name);
}
- for (i = 0; i < NSETOPTION; i++) {
- optent = &set_option_table[i];
+ for (optent = set_option_table; optent->name != NULL; optent++) {
if (strncmp(optent->name, s, strlen(s)) == 0)
ARRAY_ADD(&list, optent->name);
}
- for (i = 0; i < NSETWINDOWOPTION; i++) {
- optent = &set_window_option_table[i];
+ for (optent = set_window_option_table; optent->name != NULL; optent++) {
if (strncmp(optent->name, s, strlen(s)) == 0)
ARRAY_ADD(&list, optent->name);
}