-/* $OpenBSD: server.c,v 1.119 2015/04/21 22:32:40 nicm Exp $ */
+/* $OpenBSD: server.c,v 1.120 2015/04/22 15:05:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
server_signal_callback(int sig, unused short events, unused void *data)
{
int fd;
+
switch (sig) {
case SIGTERM:
server_shutdown = 1;
-/* $OpenBSD: tmux.h,v 1.494 2015/04/21 22:38:49 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.495 2015/04/22 15:05:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
int);
void winlink_stack_push(struct winlink_stack *, struct winlink *);
void winlink_stack_remove(struct winlink_stack *, struct winlink *);
-int window_index(struct window *, u_int *);
struct window *window_find_by_id(u_int);
struct window *window_create1(u_int, u_int);
struct window *window_create(const char *, int, char **, const char *,
-/* $OpenBSD: window.c,v 1.120 2015/04/21 22:38:50 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.121 2015/04/22 15:05:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
}
}
-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)
{
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)