[
Lists Home |
Date Index |
Thread Index
]
> Only benchmarking/profiling can tell
It's hard to beat this:
int
expand_entities_in_text_node(char* buff, int size)
{
char *start, *src;
for (start = src = buff; --size >= 0; )
{
if ((*buff++ = *src++) == '&')
{
if (size >= 3
&& src[0] == 'l' && src[1] == 't' && src[2] == ';')
buff[-1] = '<', src += 3, size -= 2;
else if (size >= 4
&& src[0] == 'a' && src[1] == 'm' && src[2] == 'p'
&& src[3] == ';')
src += 4, size -= 3;
}
}
return buff - src;
}
|