diff options
| -rw-r--r-- | txt.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -204,6 +204,7 @@ TxtLoc txt_delete_c(TxtLoc l) { int txt_load(Txt *b, const char *path) { struct stat sb; + memset(b, 0, sizeof(Txt)); int fd = open(path, O_RDONLY); if (fd == -1) goto empty_file; if (fstat(fd, &sb)) { @@ -226,7 +227,6 @@ empty_file: b->buf[TXT_SRC].n = sb.st_size; close(fd); done: - b->ptbl.n = 0; b->buf[TXT_ADD].n = 0; b->len = b->buf[TXT_SRC].n; txt_insert_piece(b, 0, TXT_SRC, 0, b->len); |
