pidgin: 0a9f6836: Surround this macro in do { } while (0);...
Mark Doliner
mark at kingant.net
Sun Jul 19 15:34:48 EDT 2009
Ah, good point. You guys are so wise! I disapproved this revision.
-Mark
On Sun, Jul 19, 2009 at 10:29 AM, Paul Aurich<paul at darkrain42.org> wrote:
> As QuLogic pointed out on #7340, this macro contains "continue;" statements
> in there (which are meant to impact the loop in
> purple_markup_html_to_xhtml), so this doesn't seem like it's OK to do.
>
> ~Paul
>
> And markdoliner at pidgin.im spoke on 07/19/2009 09:35 AM, saying:
>> -----------------------------------------------------------------
>> Revision: 0a9f6836dbe4facb38768025e830328a50c5ddd8
>> Ancestor: 567c064768c5476d5561dc04df996fb60c1aaec2
>> Author: markdoliner at pidgin.im
>> Date: 2009-07-19T16:31:32
>> Branch: im.pidgin.pidgin
>> URL: http://d.pidgin.im/viewmtn/revision/info/0a9f6836dbe4facb38768025e830328a50c5ddd8
>>
>> Modified files:
>> libpurple/util.c
>>
>> ChangeLog:
>>
>> Surround this macro in do { } while (0); so that callers don't need to
>> remember that it needs to be surrounded in braces. I think the do-while
>> isn't strictly necessary, as I think you can have braces where ever you
>> want, but everytime I see someone else use this technique they always
>> have the do-while
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> ============================================================
>> --- libpurple/util.c 6be57b7a1d754e29220193f907ba6449100ed933
>> +++ libpurple/util.c e04f24386263400d79b1229e14912f07182b0d27
>> @@ -1409,7 +1409,8 @@ struct purple_parse_tag {
>> gboolean ignore;
>> };
>>
>> -#define ALLOW_TAG_ALT(x, y) if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \
>> +#define ALLOW_TAG_ALT(x, y) do { \
>> + if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \
>> const char *o = c + strlen("<" x); \
>> const char *p = NULL, *q = NULL, *r = NULL; \
>> GString *innards = g_string_new(""); \
>> @@ -1480,6 +1481,7 @@ struct purple_parse_tag {
>> c = strchr(c, '>') + 1; \
>> continue; \
>> } \
>> + } while (0);
>> #define ALLOW_TAG(x) ALLOW_TAG_ALT(x, x)
>> void
>> purple_markup_html_to_xhtml(const char *html, char **xhtml_out,
>> @@ -1572,9 +1574,8 @@ purple_markup_html_to_xhtml(const char *
>> ALLOW_TAG("h5");
>> ALLOW_TAG("h6");
>> /* we only allow html to start the message */
>> - if(c == html) {
>> + if(c == html)
>> ALLOW_TAG("html");
>> - }
>> ALLOW_TAG_ALT("i", "em");
>> ALLOW_TAG_ALT("italic", "em");
>> ALLOW_TAG("li");
>>
>>
>> ------------------------------------------------------------------------
>>
>
> _______________________________________________
> Devel mailing list
> Devel at pidgin.im
> http://pidgin.im/cgi-bin/mailman/listinfo/devel
>
More information about the Devel
mailing list