From 4198a9c37630ad3bacafae8f27ff6b272feed0b6 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 5 Nov 2008 01:19:24 +0000 Subject: [PATCH] TAILQ -> SLIST. --- TODO | 2 ++ session.c | 16 ++++++++-------- tmux.h | 8 ++++---- tty.c | 10 +++++----- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index fc13c56b..a7fd4d58 100644 --- a/TODO +++ b/TODO @@ -32,6 +32,8 @@ - better mode features: search, back word, forward word, etc - flags to centre screen in window - better terminal emulation (identify, insert mode, some other bits) +- save stack for last window +- paste stack should be an SLIST. also key bindings? others? -- For 0.5 -------------------------------------------------------------------- diff --git a/session.c b/session.c index 1ca9e052..49f3ee8c 100644 --- a/session.c +++ b/session.c @@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.43 2008-09-26 06:45:27 nicm Exp $ */ +/* $Id: session.c,v 1.44 2008-11-05 01:19:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -33,13 +33,13 @@ session_alert_cancel(struct session *s, struct winlink *wl) { struct session_alert *sa, *sb; - sa = TAILQ_FIRST(&s->alerts); + sa = SLIST_FIRST(&s->alerts); while (sa != NULL) { sb = sa; - sa = TAILQ_NEXT(sa, entry); + sa = SLIST_NEXT(sa, entry); if (wl == NULL || sb->wl == wl) { - TAILQ_REMOVE(&s->alerts, sb, entry); + SLIST_REMOVE(&s->alerts, sb, session_alert, entry); xfree(sb); } } @@ -60,7 +60,7 @@ session_alert_add(struct session *s, struct window *w, int type) sa = xmalloc(sizeof *sa); sa->wl = wl; sa->type = type; - TAILQ_INSERT_HEAD(&s->alerts, sa, entry); + SLIST_INSERT_HEAD(&s->alerts, sa, entry); } } } @@ -70,7 +70,7 @@ session_alert_has(struct session *s, struct winlink *wl, int type) { struct session_alert *sa; - TAILQ_FOREACH(sa, &s->alerts, entry) { + SLIST_FOREACH(sa, &s->alerts, entry) { if (sa->wl == wl && sa->type == type) return (1); } @@ -83,7 +83,7 @@ session_alert_has_window(struct session *s, struct window *w, int type) { struct session_alert *sa; - TAILQ_FOREACH(sa, &s->alerts, entry) { + SLIST_FOREACH(sa, &s->alerts, entry) { if (sa->wl->window == w && sa->type == type) return (1); } @@ -119,7 +119,7 @@ session_create(const char *name, const char *cmd, u_int sx, u_int sy) fatal("gettimeofday"); s->curw = s->lastw = NULL; RB_INIT(&s->windows); - TAILQ_INIT(&s->alerts); + SLIST_INIT(&s->alerts); paste_init_stack(&s->buffers); options_init(&s->options, &global_options); diff --git a/tmux.h b/tmux.h index 8c219ff4..f8486776 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.194 2008-11-04 20:41:10 nicm Exp $ */ +/* $Id: tmux.h,v 1.195 2008-11-05 01:19:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -629,7 +629,7 @@ struct session_alert { struct winlink *wl; int type; - TAILQ_ENTRY(session_alert) entry; + SLIST_ENTRY(session_alert) entry; }; struct session { @@ -647,7 +647,7 @@ struct session { struct paste_stack buffers; - TAILQ_HEAD(, session_alert) alerts; + SLIST_HEAD(, session_alert) alerts; #define SESSION_UNATTACHED 0x1 /* not attached to any clients */ int flags; @@ -671,7 +671,7 @@ struct tty_term { #define TERM_256COLOURS 0x2 int flags; - TAILQ_ENTRY(tty_term) entry; + SLIST_ENTRY(tty_term) entry; }; struct tty { diff --git a/tty.c b/tty.c index ebd21b94..1683d5e7 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.48 2008-10-27 20:13:37 nicm Exp $ */ +/* $Id: tty.c,v 1.49 2008-11-05 01:19:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -98,7 +98,7 @@ void (*tty_cmds[])(struct tty *, struct screen *, va_list) = { tty_cmd_cell, }; -TAILQ_HEAD(, tty_term) tty_terms = TAILQ_HEAD_INITIALIZER(tty_terms); +SLIST_HEAD(, tty_term) tty_terms = SLIST_HEAD_INITIALIZER(tty_terms); void tty_init(struct tty *tty, char *path, char *term) @@ -256,7 +256,7 @@ tty_find_term(char *name, int fd, char **cause) struct tty_term *term; int error; - TAILQ_FOREACH(term, &tty_terms, entry) { + SLIST_FOREACH(term, &tty_terms, entry) { if (strcmp(term->name, name) == 0) { term->references++; return (term); @@ -267,7 +267,7 @@ tty_find_term(char *name, int fd, char **cause) term->name = xstrdup(name); term->term = NULL; term->references = 1; - TAILQ_INSERT_HEAD(&tty_terms, term, entry); + SLIST_INSERT_HEAD(&tty_terms, term, entry); if (setupterm(name, fd, &error) != OK) { switch (error) { @@ -370,7 +370,7 @@ tty_free_term(struct tty_term *term) if (--term->references != 0) return; - TAILQ_REMOVE(&tty_terms, term, entry); + SLIST_REMOVE(&tty_terms, term, tty_term, entry); #ifdef __FreeBSD___ /*