From 582660bdf3fb8684b3eff46d6c2009d763761225 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 25 Jun 2009 16:09:11 +0000 Subject: [PATCH] Miscellaneous unused functions, including one which was basically a duplicate. Found by lint. --- grid.c | 27 +-------------------------- server-fn.c | 18 +----------------- tmux.h | 10 +--------- tty-write.c | 27 +-------------------------- tty.c | 12 +----------- utf8.c | 25 +------------------------ window-more.c | 12 +----------- window.c | 17 +---------------- 8 files changed, 8 insertions(+), 140 deletions(-) diff --git a/grid.c b/grid.c index 2aa13c32..98321779 100644 --- a/grid.c +++ b/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.4 2009/06/24 22:49:56 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.5 2009/06/25 06:15:04 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -430,31 +430,6 @@ grid_move_lines(struct grid *gd, u_int dy, u_int py, u_int ny) } } -/* Clear a group of cells. */ -void -grid_clear_cells(struct grid *gd, u_int px, u_int py, u_int nx) -{ - u_int xx; - - GRID_DEBUG(gd, "px=%u, py=%u, nx=%u", px, py, nx); - - if (nx == 0) - return; - - if (grid_check_x(gd, px) != 0) - return; - if (grid_check_x(gd, px + nx - 1) != 0) - return; - if (grid_check_y(gd, py) != 0) - return; - - for (xx = px; xx < px + nx; xx++) { - if (xx >= gd->size[py]) - break; - grid_put_cell(gd, xx, py, &grid_default_cell); - } -} - /* Move a group of cells. */ void grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx) diff --git a/server-fn.c b/server-fn.c index c9355f50..9449842a 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.61 2009-05-29 23:25:26 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.2 2009/06/25 06:15:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -75,22 +75,6 @@ server_write_session( } } -void -server_write_window( - struct window *w, enum hdrtype type, const void *buf, size_t len) -{ - struct client *c; - u_int i; - - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - c = ARRAY_ITEM(&clients, i); - if (c == NULL || c->session == NULL) - continue; - if (c->session->curw->window == w) - server_write_client(c, type, buf, len); - } -} - void server_redraw_client(struct client *c) { diff --git a/tmux.h b/tmux.h index 11e4f054..7f74175d 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.11 2009/06/25 06:05:47 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.12 2009/06/25 06:15:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1128,8 +1128,6 @@ void tty_redraw_region(struct tty *, struct window_pane *); int tty_open(struct tty *, char **); void tty_close(struct tty *, int); void tty_free(struct tty *, int); -void tty_write( - struct tty *, struct window_pane *, enum tty_cmd, ...); void tty_vwrite( struct tty *, struct window_pane *, enum tty_cmd, va_list); @@ -1155,7 +1153,6 @@ int tty_keys_next(struct tty *, int *, u_char *); /* tty-write.c */ void tty_write_cmd(struct window_pane *, enum tty_cmd, ...); -void tty_write_mode(struct window_pane *, int); /* options-cmd.c */ void set_option_string(struct cmd_ctx *, @@ -1384,8 +1381,6 @@ void server_write_client( struct client *, enum hdrtype, const void *, size_t); void server_write_session( struct session *, enum hdrtype, const void *, size_t); -void server_write_window( - struct window *, enum hdrtype, const void *, size_t); void server_redraw_client(struct client *); void server_status_client(struct client *); void server_redraw_session(struct session *); @@ -1446,7 +1441,6 @@ void grid_set_utf8(struct grid *, u_int, u_int, const struct grid_utf8 *); void grid_clear(struct grid *, u_int, u_int, u_int, u_int); void grid_clear_lines(struct grid *, u_int, u_int); void grid_move_lines(struct grid *, u_int, u_int, u_int); -void grid_clear_cells(struct grid *, u_int, u_int, u_int); void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int); char *grid_string_cells(struct grid *, u_int, u_int, u_int); @@ -1560,7 +1554,6 @@ void window_set_active_pane(struct window *, struct window_pane *); struct window_pane *window_add_pane(struct window *, int, const char *, const char *, const char **, u_int, char **); void window_remove_pane(struct window *, struct window_pane *); -u_int window_index_of_pane(struct window *, struct window_pane *); struct window_pane *window_pane_at_index(struct window *, u_int); u_int window_count_panes(struct window *); void window_destroy_panes(struct window *); @@ -1607,7 +1600,6 @@ void window_scroll_pageup(struct window_pane *); /* window-more.c */ extern const struct window_mode window_more_mode; void window_more_vadd(struct window_pane *, const char *, va_list); -void printflike2 window_more_add(struct window_pane *, const char *, ...); /* window-choose.c */ extern const struct window_mode window_choose_mode; diff --git a/tty-write.c b/tty-write.c index d4bf183c..5f885fd4 100644 --- a/tty-write.c +++ b/tty-write.c @@ -1,4 +1,4 @@ -/* $Id: tty-write.c,v 1.15 2009-05-04 17:58:27 nicm Exp $ */ +/* $OpenBSD: tty-write.c,v 1.3 2009/06/25 06:15:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -64,28 +64,3 @@ tty_vwrite_cmd(struct window_pane *wp, enum tty_cmd cmd, va_list ap) } } -void -tty_write_mode(struct window_pane *wp, int mode) -{ - struct client *c; - u_int i; - - if (wp == NULL) - return; - - if (wp->window->flags & WINDOW_REDRAW || wp->flags & PANE_REDRAW) - return; - if (wp->window->flags & WINDOW_HIDDEN || wp->flags & PANE_HIDDEN) - return; - - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - c = ARRAY_ITEM(&clients, i); - if (c == NULL || c->session == NULL) - continue; - if (c->flags & CLIENT_SUSPENDED) - continue; - - tty_update_mode(&c->tty, mode); - } -} - diff --git a/tty.c b/tty.c index af6b1100..fec7c0e4 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.6 2009/06/25 05:56:44 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.7 2009/06/25 06:15:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -556,16 +556,6 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy) } } -void -tty_write(struct tty *tty, struct window_pane *wp, enum tty_cmd cmd, ...) -{ - va_list ap; - - va_start(ap, cmd); - tty_vwrite(tty, wp, cmd, ap); - va_end(ap); -} - void tty_vwrite( struct tty *tty, struct window_pane *wp, enum tty_cmd cmd, va_list ap) diff --git a/utf8.c b/utf8.c index 268d8e57..74ad512d 100644 --- a/utf8.c +++ b/utf8.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utf8.c,v 1.2 2009/06/24 05:35:07 nicm Exp $ */ +/* $OpenBSD: utf8.c,v 1.3 2009/06/25 06:15:04 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -198,7 +198,6 @@ struct utf8_width_entry *utf8_width_root = NULL; int utf8_overlap(struct utf8_width_entry *, struct utf8_width_entry *); void utf8_print(struct utf8_width_entry *, int); u_int utf8_combine(const u_char *); -void utf8_split(u_int, u_char *); int utf8_overlap( @@ -274,28 +273,6 @@ utf8_combine(const u_char *data) return (uvalue); } -void -utf8_split(u_int uvalue, u_char *data) -{ - memset(data, 0xff, 4); - - if (uvalue <= 0x7f) - data[0] = uvalue; - else if (uvalue > 0x7f && uvalue <= 0x7ff) { - data[0] = (uvalue >> 6) | 0xc0; - data[1] = (uvalue & 0x3f) | 0x80; - } else if (uvalue > 0x7ff && uvalue <= 0xffff) { - data[0] = (uvalue >> 12) | 0xe0; - data[1] = ((uvalue >> 6) & 0x3f) | 0x80; - data[2] = (uvalue & 0x3f) | 0x80; - } else if (uvalue > 0xffff && uvalue <= 0x10ffff) { - data[0] = (uvalue >> 18) | 0xf0; - data[1] = ((uvalue >> 12) & 0x3f) | 0x80; - data[2] = ((uvalue >> 6) & 0x3f) | 0x80; - data[3] = (uvalue & 0x3f) | 0x80; - } -} - int utf8_width(const u_char *udata) { diff --git a/window-more.c b/window-more.c index 998d5c2c..fc371a8a 100644 --- a/window-more.c +++ b/window-more.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-more.c,v 1.2 2009/06/24 23:00:31 nicm Exp $ */ +/* $OpenBSD: window-more.c,v 1.3 2009/06/25 06:15:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -75,16 +75,6 @@ window_more_vadd(struct window_pane *wp, const char *fmt, va_list ap) screen_write_stop(&ctx); } -void printflike2 -window_more_add(struct window_pane *wp, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - window_more_vadd(wp, fmt, ap); - va_end(ap); -} - struct screen * window_more_init(struct window_pane *wp) { diff --git a/window.c b/window.c index 2093e5c3..d1dc40f6 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.5 2009/06/24 22:49:56 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.6 2009/06/25 06:15:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -341,21 +341,6 @@ window_remove_pane(struct window *w, struct window_pane *wp) window_pane_destroy(wp); } -u_int -window_index_of_pane(struct window *w, struct window_pane *find) -{ - struct window_pane *wp; - u_int n; - - n = 0; - TAILQ_FOREACH(wp, &w->panes, entry) { - if (wp == find) - return (n); - n++; - } - fatalx("unknown pane"); -} - struct window_pane * window_pane_at_index(struct window *w, u_int idx) {