# HG changeset patch # User Mark Doliner # Date 1249030510 0 # Node ID 70219821df98e48395c8ffb1b1fa0a83cf93e1ce # Parent 8660d8bc467caa8a00158fc6f47c37699705611d Make match a const char *, and remove two unnecessary casts diff -r 8660d8bc467c -r 70219821df98 libpurple/protocols/yahoo/util.c --- 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, "", 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, "str, "