changeset 28104:70219821df98

Make match a const char *, and remove two unnecessary casts
author Mark Doliner <mark@kingant.net>
date Fri, 31 Jul 2009 08:55:10 +0000
parents 8660d8bc467c
children 516993d86e72
files libpurple/protocols/yahoo/util.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/util.c	Fri Jul 31 08:47:42 2009 +0000
+++ b/libpurple/protocols/yahoo/util.c	Fri Jul 31 08:55:10 2009 +0000
@@ -342,13 +342,15 @@
 	GString *s, *tmp;
 	int i, j;
 	gboolean no_more_end_tags = FALSE; /* s/endtags/closinganglebrackets */
-	char *match;
+	const char *match;
 
 	x_len = strlen(x);
 	s = g_string_sized_new(x_len);
 
 	for (i = 0; i < x_len; i++) {
 		if ((x[i] == 0x1b) && (x[i+1] == '[')) {
+			/* This is the beginning of an escape sequence, which
+			 * contains text formatting. */
 			j = i + 1;
 
 			while (j++ < x_len) {
@@ -358,7 +360,7 @@
 					tmp = g_string_new_len(x + i + 2, j - i - 2);
 					if (tmp->str[0] == '#')
 						g_string_append_printf(s, "<span style=\"color: %s\">", tmp->str);
-					else if ((match = (char *) g_hash_table_lookup(ht, tmp->str)))
+					else if ((match = g_hash_table_lookup(ht, tmp->str)))
 						g_string_append(s, match);
 					else {
 						purple_debug_error("yahoo",
@@ -388,7 +390,7 @@
 					tmp = g_string_new_len(x + i, j - i + 1);
 					g_string_ascii_down(tmp);
 
-					if ((match = (char *) g_hash_table_lookup(ht, tmp->str)))
+					if ((match = g_hash_table_lookup(ht, tmp->str)))
 						g_string_append(s, match);
 					else if (!strncmp(tmp->str, "<fade ", 6) ||
 						!strncmp(tmp->str, "<alt ", 5) ||