pidgin: 5d26d612: Make a note about these ALLOW_TAG* macro...

qulogic at pidgin.im qulogic at pidgin.im
Mon Jul 20 01:15:40 EDT 2009


-----------------------------------------------------------------
Revision: 5d26d6124f82c0ad970c666b58e7c76c496d9191
Ancestor: 0b945396e5ed5227bcd053301c928928f0eb0c15
Author: qulogic at pidgin.im
Date: 2009-07-20T01:28:11
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5d26d6124f82c0ad970c666b58e7c76c496d9191

Modified files:
        libpurple/util.c

ChangeLog: 

Make a note about these ALLOW_TAG* macros so people don't do stuff like
Mark did again.

-------------- next part --------------
============================================================
--- libpurple/util.c	6be57b7a1d754e29220193f907ba6449100ed933
+++ libpurple/util.c	785d467dcac110839da5a11c1017f56b10e7144b
@@ -1409,6 +1409,12 @@ struct purple_parse_tag {
 	gboolean ignore;
 };
 
+/* NOTE: Do not put `do {} while(0)` around this macro (as this is the method
+         recommended in the GCC docs). It contains 'continue's that should
+         affect the while-loop in purple_markup_html_to_xhtml and doing the
+         above would break that.
+         Also, remember to put braces in constructs that require them for
+         multiple statements when using this macro. */
 #define ALLOW_TAG_ALT(x, y) if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \
 						const char *o = c + strlen("<" x); \
 						const char *p = NULL, *q = NULL, *r = NULL; \
@@ -1479,7 +1485,8 @@ struct purple_parse_tag {
 						} \
 						c = strchr(c, '>') + 1; \
 						continue; \
-					} \
+					}
+/* Don't forget to check the note above for ALLOW_TAG_ALT. */
 #define ALLOW_TAG(x) ALLOW_TAG_ALT(x, x)
 void
 purple_markup_html_to_xhtml(const char *html, char **xhtml_out,


More information about the Commits mailing list