51 static char *buf =
nullptr;
52 static size_t bufsize = 0;
60 if (!buf || strlen(
string) * 6 > bufsize) {
62 bufsize = strlen(
string) * 6 + 1;
63 buf =
static_cast<char *
>(
xcalloc(bufsize, 1));
65 for (src =
string, dst = buf; *src; src++) {
66 const char *escape =
NULL;
67 const unsigned char ch = *src;
82 if (!escape && (ch <= 0x1F || ch >= 0x7f) && ch !=
'\n' && ch !=
'\r' && ch !=
'\t') {
83 static char dec_encoded[7];
84 snprintf(dec_encoded,
sizeof dec_encoded,
"&#%3d;", (
int) ch);
89 strncpy(dst, escape, 7);
90 dst += strlen(escape);
char * html_quote(const char *string)
static struct @72 htmlstandardentities[]
void * xcalloc(size_t n, size_t sz)