# HG changeset patch # User Mark Doliner # Date 1249419191 0 # Node ID 5eca0f387c13ef9bafa32d915436691fea44f851 # Parent 90b471ba5282574b171f23ffba630107757bdf15 Make this enum follow our naming conventions a little better diff -r 90b471ba5282 -r 5eca0f387c13 libpurple/protocols/yahoo/util.c --- a/libpurple/protocols/yahoo/util.c Tue Aug 04 08:16:09 2009 +0000 +++ b/libpurple/protocols/yahoo/util.c Tue Aug 04 20:53:11 2009 +0000 @@ -644,6 +644,8 @@ xmlnode_free(html); /* Strip off the outter HTML node */ + /* This probably isn't necessary, especially if we made the outter HTML + * node an empty span. But the HTML is simpler this way. */ xmlstr2 = g_strndup(xmlstr1 + 6, strlen(xmlstr1) - 13); g_free(xmlstr1); @@ -656,8 +658,16 @@ #define POINT_SIZE(x) (_point_sizes [MIN ((x > 0 ? x : 1), MAX_FONT_SIZE) - 1]) static const gint _point_sizes [] = { 8, 10, 12, 14, 20, 30, 40 }; -enum fatype { size, color, face, junk }; -typedef struct { +enum fatype +{ + FATYPE_SIZE, + FATYPE_COLOR, + FATYPE_FACE, + FATYPE_JUNK +}; + +typedef struct +{ enum fatype type; union { int size; @@ -669,9 +679,9 @@ static void fontattr_free(fontattr *f) { - if (f->type == color) + if (f->type == FATYPE_COLOR) g_free(f->u.color); - else if (f->type == face) + else if (f->type == FATYPE_FACE) g_free(f->u.face); g_free(f); } @@ -731,7 +741,7 @@ fontattr *f; f = g_new(fontattr, 1); - f->type = face; + f->type = FATYPE_FACE; f->u.face = g_strndup(&src[vstart+1], n-vstart-1); if (!ftattr) ftattr = g_queue_new(); @@ -742,7 +752,7 @@ fontattr *f; f = g_new(fontattr, 1); - f->type = size; + f->type = FATYPE_SIZE; f->u.size = POINT_SIZE(strtol(&src[vstart+1], NULL, 10)); if (!ftattr) ftattr = g_queue_new(); @@ -753,7 +763,7 @@ fontattr *f; f = g_new(fontattr, 1); - f->type = color; + f->type = FATYPE_COLOR; f->u.color = g_strndup(&src[vstart+1], n-vstart-1); if (!ftattr) ftattr = g_queue_new(); @@ -764,7 +774,7 @@ fontattr *f; f = g_new(fontattr, 1); - f->type = junk; + f->type = FATYPE_JUNK; f->u.junk = g_strndup(&src[*j+1], n-*j); if (!ftattr) ftattr = g_queue_new(); @@ -789,7 +799,7 @@ if (!g_queue_is_empty(ftattr)) { while ((f = g_queue_pop_tail(ftattr))) { switch (f->type) { - case size: + case FATYPE_SIZE: if (!needendtag) { needendtag = 1; g_string_append(dest, "u.size); fontattr_free(f); break; - case face: + case FATYPE_FACE: if (!needendtag) { needendtag = 1; g_string_append(dest, "u.face); fontattr_free(f); break; - case junk: + case FATYPE_JUNK: if (!needendtag) { needendtag = 1; g_string_append(dest, ""); dest->str[dest->len-1] = '>'; @@ -850,7 +860,6 @@ break; } } - } char *yahoo_html_to_codes(const char *src)