diff options
author | wrmr | 2024-11-09 02:04:33 -0500 |
---|---|---|
committer | wrmr | 2024-11-09 02:04:33 -0500 |
commit | 38987f3f5a3919ac81ba419e05ac8610c269faff (patch) | |
tree | dc76c691f0e7d8385224ede708b9390b50b68dff /doc.c | |
parent | 12d5d0df5c4b958bbb5cc339a9e556c50136a974 (diff) |
rename buf_t to str_t, and consolidate str.c/h with strv.c/h
Diffstat (limited to 'doc.c')
-rw-r--r-- | doc.c | 16 |
1 files changed, 8 insertions, 8 deletions
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++; } |