summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWormHeamer2026-01-02 20:27:28 -0500
committerWormHeamer2026-01-02 20:27:28 -0500
commitc118b375ec2d4d6d4b1810265953a0c0b8783169 (patch)
tree211df2b085c2f33c45b10f938ed73f9127b8f407
parent862cc0d37f5b2672ed781fdd30962da7028d967c (diff)
fix Txt not being zeroed properly
-rw-r--r--txt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/txt.c b/txt.c
index 164bf16..e5fc878 100644
--- a/txt.c
+++ b/txt.c
@@ -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);