pidgin: 3ea04f7c: Move where the ftattr queue is defined

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Aug 19 21:25:27 EDT 2009


-----------------------------------------------------------------
Revision: 3ea04f7c79d367136a2e7c4cffd8a2151c5e8f20
Ancestor: ef6141be3fa75ac5dce43df3dd9b62d057a923d1
Author: markdoliner at pidgin.im
Date: 2009-08-20T01:24:24
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3ea04f7c79d367136a2e7c4cffd8a2151c5e8f20

Modified files:
        libpurple/protocols/yahoo/util.c

ChangeLog: 

Move where the ftattr queue is defined

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/util.c	fb32f0c06fc054d40cec27de24f9a283bd7a43d1
+++ libpurple/protocols/yahoo/util.c	939ad39e2f9fad65f0b6dd32f200e20d07986c5d
@@ -715,8 +715,9 @@ static void parse_font_tag(const char *s
 }
 
 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 @@ static void parse_font_tag(const char *s
 	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 @@ static void parse_font_tag(const char *s
 		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 @@ static void parse_font_tag(const char *s
 		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 @@ static void parse_font_tag(const char *s
 		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 @@ static void parse_font_tag(const char *s
 	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 @@ static void parse_font_tag(const char *s
 		}
 
 		g_queue_free(ftattr);
-		ftattr = NULL;
 
 		if (needendtag) {
 			dest->str[dest->len-1] = '>';
@@ -820,7 +816,6 @@ char *yahoo_html_to_codes(const char *sr
 	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 @@ char *yahoo_html_to_codes(const char *sr
 						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;


More information about the Commits mailing list