vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit ff96ac485fc2e9f53794028d745b6938ccb757ad parent b0fd63cbe9862967603a7f17eb4ea160056d162b Author: Marc André Tanner <mat@brain-dump.org> Date: Thu, 9 Feb 2017 11:09:58 +0100 text: fix use of uninitialized variable in error path Diffstat:
| M | text.c | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/text.c b/text.c @@ -1109,14 +1109,14 @@ ssize_t text_write_range(Text *txt, Filerange *range, int fd) { /* load the given file as starting point for further editing operations. * to start with an empty document, pass NULL as filename. */ Text *text_load(const char *filename) { + int fd = -1; + size_t size = 0; Text *txt = calloc(1, sizeof *txt); if (!txt) return NULL; Piece *p = piece_alloc(txt); if (!p) goto out; - size_t size = 0; - int fd = -1; lineno_cache_invalidate(&txt->lines); if (filename) { if ((fd = open(filename, O_RDONLY)) == -1)