From 38987f3f5a3919ac81ba419e05ac8610c269faff Mon Sep 17 00:00:00 2001 From: wrmr Date: Sat, 9 Nov 2024 02:04:33 -0500 Subject: rename buf_t to str_t, and consolidate str.c/h with strv.c/h --- doc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'doc.c') diff --git a/doc.c b/doc.c index aa18369..a8e7975 100644 --- a/doc.c +++ b/doc.c @@ -8,8 +8,8 @@ /* initialization / destruction */ void doc_init(struct doc *d) { - buf_init(&d->txt, sizeof(struct doc_line)); - buf_init(&d->lnk, 1); + str_init(&d->txt, sizeof(struct doc_line)); + str_init(&d->lnk, 1); d->txt.sz = sizeof(struct doc_line); *(struct doc_line *)d->txt.buf = (struct doc_line) { .prev = 0, @@ -21,14 +21,14 @@ void doc_init(struct doc *d) { } void doc_fini(struct doc *d) { - buf_free(&d->txt); - buf_free(&d->lnk); + str_free(&d->txt); + str_free(&d->lnk); } /* line creation */ void doc_new_line(struct doc *d) { - buf_grow(&d->txt, sizeof(struct doc_line)); + str_grow(&d->txt, sizeof(struct doc_line)); *(struct doc_line *)&d->txt.buf[d->txt.sz] = (struct doc_line) { .prev = ((struct doc_line *)&d->txt.buf[d->latest])->len, .link = DOC_LINK_NONE, @@ -44,7 +44,7 @@ void doc_add_line(struct doc *d, strv_t s) { } void doc_add_text(struct doc *d, strv_t s) { - buf_grow(&d->txt, s.n); + str_grow(&d->txt, s.n); memcpy(&d->txt.buf[d->txt.sz], s.s, s.n); struct doc_line *dl = (struct doc_line *)&d->txt.buf[d->latest]; d->txt.sz += s.n; @@ -52,8 +52,8 @@ void doc_add_text(struct doc *d, strv_t s) { } unsigned short doc_add_link(struct doc *d, strv_t url) { - buf_cat(&d->lnk, url); - buf_catc(&d->lnk, 0); + str_cat(&d->lnk, url); + str_catc(&d->lnk, 0); return d->linkc++; } -- cgit 1.4.1-2-gfad0