diff options
author | wrmr | 2024-11-08 23:25:03 -0500 |
---|---|---|
committer | wrmr | 2024-11-08 23:25:03 -0500 |
commit | 012ed5bd6455ce291741ad540a5e356e4810133b (patch) | |
tree | 32bfb5425b1f1a899c497ce817b44111dcd0ff54 /doc.c | |
parent | 6050dcdd3669b7102f35a226a6a3ee485c7b703a (diff) |
use strv_t for doc_add_text, remove doc_add_textn, add strv()
Diffstat (limited to 'doc.c')
-rw-r--r-- | doc.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/doc.c b/doc.c index 97d8b34..d43ff30 100644 --- a/doc.c +++ b/doc.c @@ -39,20 +39,16 @@ void doc_new_line(struct doc *d) { } void doc_add_line(struct doc *d, strv_t s) { - doc_add_textn(d, s.s, s.n); + doc_add_text(d, s); doc_new_line(d); } -void doc_add_text(struct doc *d, const char *s) { - doc_add_textn(d, s, strlen(s)); -} - -void doc_add_textn(struct doc *d, const char *s, size_t n) { - buf_grow(&d->txt, n); - memcpy(&d->txt.buf[d->txt.sz], s, n); +void doc_add_text(struct doc *d, strv_t s) { + buf_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 += n; - dl->len += n; + d->txt.sz += s.n; + dl->len += s.n; } unsigned short doc_add_link(struct doc *d, const char *url) { |