From 7425122c1cd2aff909d72b33ef07b6a71d0c6922 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 4 Apr 2010 18:48:37 +0000 Subject: [PATCH] Squash a function that is only called in a callback into the callback function. --- tmux.h | 1 - window.c | 31 ++++++++++++------------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/tmux.h b/tmux.h index 3145b742..576c4977 100644 --- a/tmux.h +++ b/tmux.h @@ -1828,7 +1828,6 @@ void window_pane_alternate_off( int window_pane_set_mode( struct window_pane *, const struct window_mode *); void window_pane_reset_mode(struct window_pane *); -void window_pane_parse(struct window_pane *); void window_pane_key(struct window_pane *, struct client *, int); void window_pane_mouse(struct window_pane *, struct client *, struct mouse_event *); diff --git a/window.c b/window.c index 7f2eac8d..4a801a76 100644 --- a/window.c +++ b/window.c @@ -586,9 +586,19 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, void window_pane_read_callback(unused struct bufferevent *bufev, void *data) { - struct window_pane *wp = data; + struct window_pane *wp = data; + char *new_data; + size_t new_size; - window_pane_parse(wp); + new_size = EVBUFFER_LENGTH(wp->event->input) - wp->pipe_off; + if (wp->pipe_fd != -1 && new_size > 0) { + new_data = EVBUFFER_DATA(wp->event->input); + bufferevent_write(wp->pipe_event, new_data, new_size); + } + + input_parse(wp); + + wp->pipe_off = EVBUFFER_LENGTH(wp->event->input); } /* ARGSUSED */ @@ -726,23 +736,6 @@ window_pane_reset_mode(struct window_pane *wp) wp->flags |= PANE_REDRAW; } -void -window_pane_parse(struct window_pane *wp) -{ - char *data; - size_t new_size; - - new_size = EVBUFFER_LENGTH(wp->event->input) - wp->pipe_off; - if (wp->pipe_fd != -1 && new_size > 0) { - data = EVBUFFER_DATA(wp->event->input); - bufferevent_write(wp->pipe_event, data, new_size); - } - - input_parse(wp); - - wp->pipe_off = EVBUFFER_LENGTH(wp->event->input); -} - void window_pane_key(struct window_pane *wp, struct client *c, int key) {