diff options
| author | WormHeamer | 2026-01-02 20:27:28 -0500 |
|---|---|---|
| committer | WormHeamer | 2026-01-02 20:27:28 -0500 |
| commit | c118b375ec2d4d6d4b1810265953a0c0b8783169 (patch) | |
| tree | 211df2b085c2f33c45b10f938ed73f9127b8f407 | |
| parent | 862cc0d37f5b2672ed781fdd30962da7028d967c (diff) | |
fix Txt not being zeroed properly
| -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); |
