From: Jonas Fonseca Date: Wed, 2 Jun 2010 16:10:20 +0000 (-0400) Subject: Move and rewrite io_format to become prepare_io X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=01223083701dfebf0d5588b4217452b902e3a78b;p=tig.git Move and rewrite io_format to become prepare_io --- diff --git a/tig.c b/tig.c index 1bf95cd..86be4a2 100644 --- a/tig.c +++ b/tig.c @@ -753,14 +753,6 @@ io_prepare(struct io *io, const char *dir, enum io_type type, const char *argv[] argv_copy(io->argv, argv, FALSE); } -static bool -io_format(struct io *io, const char *dir, enum io_type type, - const char *argv[], enum format_flags flags) -{ - io_init(io, dir, type); - return format_argv(io->argv, argv, flags); -} - static bool io_open(struct io *io, const char *fmt, ...) { @@ -3278,12 +3270,19 @@ setup_update(struct view *view, const char *vid) view->start_time = time(NULL); } +static bool +prepare_io(struct view *view, const char *dir, const char *argv[], bool replace) +{ + io_init(&view->io, dir, IO_RD); + return format_argv(view->io.argv, argv, replace ? FORMAT_ALL : FORMAT_NONE); +} + static bool prepare_update(struct view *view, const char *argv[], const char *dir) { if (view->pipe) end_update(view, TRUE); - return io_format(&view->io, dir, IO_RD, argv, FORMAT_NONE); + return prepare_io(view, dir, argv, FALSE); } static bool @@ -3291,7 +3290,7 @@ start_update(struct view *view, const char **argv, const char *dir) { if (view->pipe) io_done(view->pipe); - return io_format(&view->io, dir, IO_RD, argv, FORMAT_NONE) && + return prepare_io(view, dir, argv, FALSE) && io_start(&view->io); } @@ -3313,7 +3312,7 @@ begin_update(struct view *view, bool refresh) if (view->ops->prepare) { if (!view->ops->prepare(view)) return FALSE; - } else if (!io_format(&view->io, NULL, IO_RD, view->ops->argv, FORMAT_ALL)) { + } else if (!prepare_io(view, NULL, view->ops->argv, TRUE)) { return FALSE; } @@ -4822,7 +4821,7 @@ tree_prepare(struct view *view) opt_path[0] = 0; } - return io_format(&view->io, opt_cdup, IO_RD, view->ops->argv, FORMAT_ALL); + return prepare_io(view, opt_cdup, view->ops->argv, TRUE); } static const char *tree_argv[SIZEOF_ARG] = {