summaryrefslogtreecommitdiffstats
path: root/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-07-15 17:44:47 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-07-15 17:44:47 +0000
commitff90170738dad3ab6d302790672c57a3e10e9075 (patch)
tree7bee01c0f92b2536cb6850cdfbb4d040b61ab8a2 /status.c
parent6ebb1df8fe161678c3550e59774ec4894551ba3e (diff)
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.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/status.c b/status.c
index 4e3eaf0a..7442f162 100644
--- a/status.c
+++ b/status.c
@@ -1,4 +1,4 @@
-/* $Id: status.c,v 1.93 2009-07-15 17:44:06 nicm Exp $ */
+/* $Id: status.c,v 1.94 2009-07-15 17:44:47 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
}