=================================================================== RCS file: /cvs/mandoc/html.c,v retrieving revision 1.141 retrieving revision 1.143 diff -u -p -r1.141 -r1.143 --- mandoc/html.c 2011/05/17 11:19:45 1.141 +++ mandoc/html.c 2011/05/17 11:38:18 1.143 @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.141 2011/05/17 11:19:45 kristaps Exp $ */ +/* $Id: html.c,v 1.143 2011/05/17 11:38:18 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -656,6 +656,7 @@ buffmt_includes(struct html *h, const char *name) pp = h->base_includes; + bufinit(h); while (NULL != (p = strchr(pp, '%'))) { bufncat(h, pp, (size_t)(p - pp)); switch (*(p + 1)) { @@ -680,7 +681,7 @@ buffmt_man(struct html *h, pp = h->base_man; - /* LINTED */ + bufinit(h); while (NULL != (p = strchr(pp, '%'))) { bufncat(h, pp, (size_t)(p - pp)); switch (*(p + 1)) { @@ -713,32 +714,11 @@ bufcat_su(struct html *h, const char *p, const struct } void -html_idcat(char *dst, const char *src, int sz) +bufcat_id(struct html *h, const char *src) { - int ssz; - assert(sz > 2); - /* Cf. . */ - /* We can't start with a number (bah). */ - - if ('#' == *dst) { - dst++; - sz--; - } - if ('\0' == *dst) { - *dst++ = 'x'; - *dst = '\0'; - sz--; - } - - for ( ; *dst != '\0' && sz; dst++, sz--) - /* Jump to end. */ ; - - for ( ; *src != '\0' && sz > 1; src++) { - ssz = snprintf(dst, (size_t)sz, "%.2x", *src); - sz -= ssz; - dst += ssz; - } + while ('\0' != *src) + bufcat_fmt(h, "%.2x", *src++); }