Mercurial > pidgin
changeset 28017:2d2856a2e7c2
Move where the ftattr queue is defined
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 20 Aug 2009 01:24:24 +0000 |
parents | 2aabf39b5581 |
children | 8b68373bf393 |
files | libpurple/protocols/yahoo/util.c |
diffstat | 1 files changed, 6 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/util.c Thu Aug 20 01:12:06 2009 +0000 +++ b/libpurple/protocols/yahoo/util.c Thu Aug 20 01:24:24 2009 +0000 @@ -715,8 +715,9 @@ } static void parse_font_tag(const char *src, GString *dest, const char *tag_name, const char *tag, - int src_len, GSList **colors, GSList **tags, GQueue *ftattr) + int src_len, GSList **colors, GSList **tags) { + GQueue *ftattr; const char *start; const char *end; GData *attributes; @@ -725,6 +726,8 @@ fontattr *f; GString *tmp; + ftattr = g_queue_new(); + purple_markup_find_tag(tag_name, tag, &start, &end, &attributes); attribute = g_datalist_get_data(&attributes, "color"); @@ -732,8 +735,6 @@ f = g_new(fontattr, 1); f->type = FATYPE_COLOR; f->u.color = g_strdup(attribute); - if (!ftattr) - ftattr = g_queue_new(); g_queue_push_head(ftattr, f); } @@ -742,8 +743,6 @@ f = g_new(fontattr, 1); f->type = FATYPE_FACE; f->u.face = g_strdup(attribute); - if (!ftattr) - ftattr = g_queue_new(); g_queue_push_tail(ftattr, f); } @@ -752,8 +751,6 @@ f = g_new(fontattr, 1); f->type = FATYPE_SIZE; f->u.size = POINT_SIZE(strtol(attribute, NULL, 10)); - if (!ftattr) - ftattr = g_queue_new(); g_queue_push_tail(ftattr, f); } @@ -762,7 +759,7 @@ needendtag = FALSE; tmp = g_string_new(NULL); - if (ftattr != NULL && !g_queue_is_empty(ftattr)) { + if (!g_queue_is_empty(ftattr)) { while ((f = g_queue_pop_tail(ftattr))) { switch (f->type) { case FATYPE_SIZE: @@ -799,7 +796,6 @@ } g_queue_free(ftattr); - ftattr = NULL; if (needendtag) { dest->str[dest->len-1] = '>'; @@ -820,7 +816,6 @@ int i, j; GString *dest; char *esc; - GQueue *ftattr = NULL; gboolean no_more_gt_brackets = FALSE; gchar *tag, *tag_name; gboolean is_closing_tag; @@ -896,7 +891,7 @@ j = end - src + 3; } else if (g_str_equal(tag_name, "font")) { - parse_font_tag(src, dest, tag_name, tag, src_len, &colors, &tags, ftattr); + parse_font_tag(src, dest, tag_name, tag, src_len, &colors, &tags); } else if (g_str_equal(tag_name, "b")) { g_string_append(dest, "\033[1m"); current_state.bold = TRUE;