libpurple/util.c

changeset 27892
f2a4844fc72f
parent 27882
ef88f5abc345
child 27902
74e7df7a19f3
equal deleted inserted replaced
27891:92e3be9c1613 27892:f2a4844fc72f
1407 char *src_tag; 1407 char *src_tag;
1408 char *dest_tag; 1408 char *dest_tag;
1409 gboolean ignore; 1409 gboolean ignore;
1410 }; 1410 };
1411 1411
1412 /* NOTE: Do not put `do {} while(0)` around this macro (as this is the method
1413 recommended in the GCC docs). It contains 'continue's that should
1414 affect the while-loop in purple_markup_html_to_xhtml and doing the
1415 above would break that.
1416 Also, remember to put braces in constructs that require them for
1417 multiple statements when using this macro. */
1412 #define ALLOW_TAG_ALT(x, y) if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \ 1418 #define ALLOW_TAG_ALT(x, y) if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \
1413 const char *o = c + strlen("<" x); \ 1419 const char *o = c + strlen("<" x); \
1414 const char *p = NULL, *q = NULL, *r = NULL; \ 1420 const char *p = NULL, *q = NULL, *r = NULL; \
1415 GString *innards = g_string_new(""); \ 1421 GString *innards = g_string_new(""); \
1416 while(o && *o) { \ 1422 while(o && *o) { \
1477 if(xhtml) \ 1483 if(xhtml) \
1478 xhtml = g_string_append(xhtml, "/>");\ 1484 xhtml = g_string_append(xhtml, "/>");\
1479 } \ 1485 } \
1480 c = strchr(c, '>') + 1; \ 1486 c = strchr(c, '>') + 1; \
1481 continue; \ 1487 continue; \
1482 } \ 1488 }
1489 /* Don't forget to check the note above for ALLOW_TAG_ALT. */
1483 #define ALLOW_TAG(x) ALLOW_TAG_ALT(x, x) 1490 #define ALLOW_TAG(x) ALLOW_TAG_ALT(x, x)
1484 void 1491 void
1485 purple_markup_html_to_xhtml(const char *html, char **xhtml_out, 1492 purple_markup_html_to_xhtml(const char *html, char **xhtml_out,
1486 char **plain_out) 1493 char **plain_out)
1487 { 1494 {

mercurial