diff options
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) { |