buffer: remove useless buffer_add_xmlescaped()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
7dbb02adf3
commit
c95e73ee61
|
@ -114,40 +114,3 @@ buffer_detach(buffer_t *buf)
|
|||
buffer_init(buf);
|
||||
return res;
|
||||
}
|
||||
|
||||
/** Add a string to a buffer, escaping XML chars.
|
||||
* \param buf Where to add data.
|
||||
* \param s The string to add.
|
||||
*/
|
||||
void
|
||||
buffer_add_xmlescaped(buffer_t *buf, const char *s)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
int len = strcspn(s, "&<>'\"");
|
||||
buffer_add(buf, s, len);
|
||||
s += len;
|
||||
|
||||
switch (*s++)
|
||||
{
|
||||
case '\0':
|
||||
return;
|
||||
case '&':
|
||||
buffer_adds(buf, "&");
|
||||
break;
|
||||
case '<':
|
||||
buffer_adds(buf, "<");
|
||||
break;
|
||||
case '>':
|
||||
buffer_adds(buf, ">");
|
||||
break;
|
||||
case '\'':
|
||||
/* OG: why not use default? */
|
||||
buffer_adds(buf, "'");
|
||||
break;
|
||||
case '"':
|
||||
buffer_adds(buf, """);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,7 +192,4 @@ void buffer_addvf(buffer_t *buf, const char *fmt, va_list)
|
|||
void buffer_addf(buffer_t *buf, const char *fmt, ...)
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
|
||||
|
||||
void buffer_add_xmlescaped(buffer_t *buf, const char *s);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue