diff options
author | nicm <nicm> | 2015-04-22 15:05:03 +0000 |
---|---|---|
committer | nicm <nicm> | 2015-04-22 15:05:03 +0000 |
commit | 89e80cabd56bf2f7fa783575fe9b1f6192fade42 (patch) | |
tree | 850d871065ae0a7db26ed6726989a1ca29bbf4b3 /window.c | |
parent | 3909aff06aa6de748ae057cab1e723eec2387edd (diff) | |
download | rtmux-89e80cabd56bf2f7fa783575fe9b1f6192fade42.tar.gz rtmux-89e80cabd56bf2f7fa783575fe9b1f6192fade42.tar.bz2 rtmux-89e80cabd56bf2f7fa783575fe9b1f6192fade42.zip |
window_index is only used in one place (window_destroy) so inline it there.
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -245,16 +245,6 @@ winlink_stack_remove(struct winlink_stack *stack, struct winlink *wl) } } -int -window_index(struct window *s, u_int *i) -{ - for (*i = 0; *i < ARRAY_LENGTH(&windows); (*i)++) { - if (s == ARRAY_ITEM(&windows, *i)) - return (0); - } - return (-1); -} - struct window * window_find_by_id(u_int id) { @@ -341,7 +331,11 @@ window_destroy(struct window *w) window_unzoom(w); - if (window_index(w, &i) != 0) + for (i = 0; i < ARRAY_LENGTH(&windows); i++) { + if (w == ARRAY_ITEM(&windows, i)) + break; + } + if (i == ARRAY_LENGTH(&windows)) fatalx("index not found"); ARRAY_SET(&windows, i, NULL); while (!ARRAY_EMPTY(&windows) && ARRAY_LAST(&windows) == NULL) |