changeset 27641:1316f2b180be

Make a note about these ALLOW_TAG* macros so people don't do stuff like Mark did again.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 20 Jul 2009 01:28:11 +0000
parents 1694eb347a78
children 48148e688ad1
files libpurple/util.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/util.c	Sun Jul 19 23:26:50 2009 +0000
+++ b/libpurple/util.c	Mon Jul 20 01:28:11 2009 +0000
@@ -1409,6 +1409,12 @@
 	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 @@
 						} \
 						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,