mirror of
https://github.com/tmux/tmux.git
synced 2025-01-13 03:48:51 +00:00
window_index is only used in one place (window_destroy) so inline it there.
This commit is contained in:
parent
3909aff06a
commit
89e80cabd5
1
server.c
1
server.c
@ -389,6 +389,7 @@ void
|
|||||||
server_signal_callback(int sig, unused short events, unused void *data)
|
server_signal_callback(int sig, unused short events, unused void *data)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
switch (sig) {
|
switch (sig) {
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
server_shutdown = 1;
|
server_shutdown = 1;
|
||||||
|
1
tmux.h
1
tmux.h
@ -2141,7 +2141,6 @@ struct winlink *winlink_previous_by_number(struct winlink *, struct session *,
|
|||||||
int);
|
int);
|
||||||
void winlink_stack_push(struct winlink_stack *, struct winlink *);
|
void winlink_stack_push(struct winlink_stack *, struct winlink *);
|
||||||
void winlink_stack_remove(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_find_by_id(u_int);
|
||||||
struct window *window_create1(u_int, u_int);
|
struct window *window_create1(u_int, u_int);
|
||||||
struct window *window_create(const char *, int, char **, const char *,
|
struct window *window_create(const char *, int, char **, const char *,
|
||||||
|
16
window.c
16
window.c
@ -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 *
|
struct window *
|
||||||
window_find_by_id(u_int id)
|
window_find_by_id(u_int id)
|
||||||
{
|
{
|
||||||
@ -341,7 +331,11 @@ window_destroy(struct window *w)
|
|||||||
|
|
||||||
window_unzoom(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");
|
fatalx("index not found");
|
||||||
ARRAY_SET(&windows, i, NULL);
|
ARRAY_SET(&windows, i, NULL);
|
||||||
while (!ARRAY_EMPTY(&windows) && ARRAY_LAST(&windows) == NULL)
|
while (!ARRAY_EMPTY(&windows) && ARRAY_LAST(&windows) == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user