56 static size_t bufsize = 0;
64 if (buf ==
NULL || strlen(
string) * 6 > bufsize) {
66 bufsize = strlen(
string) * 6 + 1;
69 for (src =
string, dst = buf; *src; src++) {
70 const char *escape =
NULL;
71 const unsigned char ch = *src;
86 if (!escape && (ch <= 0x1F || ch >= 0x7f) && ch !=
'\n' && ch !=
'\r' && ch !=
'\t') {
87 static char dec_encoded[7];
88 snprintf(dec_encoded,
sizeof dec_encoded,
"&#%3d;", (
int) ch);
93 strncpy(dst, escape, 7);
94 dst += strlen(escape);
char * html_quote(const char *string)
static struct @20 htmlstandardentities[]
void * xcalloc(size_t n, size_t sz)