Code

Introduce refresh_view based on load_view
[tig.git] / io.c
diff --git a/io.c b/io.c
index 685ffb6cfeb77d7573156f4cec6332fc0cabdce7..fabde00747eb5130e4b33c0dbe744ed05bc64977 100644 (file)
--- a/io.c
+++ b/io.c
@@ -97,6 +97,7 @@ argv_copy(const char ***dst, const char *src[])
 {
        int argc;
 
+       argv_free(*dst);
        for (argc = 0; src[argc]; argc++)
                if (!argv_append(dst, src[argc]))
                        return FALSE;
@@ -276,7 +277,7 @@ io_strerror(struct io *io)
 }
 
 bool
-io_can_read(struct io *io)
+io_can_read(struct io *io, bool can_block)
 {
        struct timeval tv = { 0, 500 };
        fd_set fds;
@@ -284,7 +285,7 @@ io_can_read(struct io *io)
        FD_ZERO(&fds);
        FD_SET(io->pipe, &fds);
 
-       return select(io->pipe + 1, &fds, NULL, NULL, &tv) > 0;
+       return select(io->pipe + 1, &fds, NULL, NULL, can_block ? NULL : &tv) > 0;
 }
 
 ssize_t