im.pidgin.pidgin: 48dc4ee055916f77c187f093dccfc198759ef573

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Thu Jan 17 01:35:53 EST 2008


-----------------------------------------------------------------
Revision: 48dc4ee055916f77c187f093dccfc198759ef573
Ancestor: 9c11352104fa6f335fcb0a53b69bebaed59da7bb
Author: rekkanoryo at pidgin.im
Date: 2008-01-17T06:11:57
Branch: im.pidgin.pidgin

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

ChangeLog: 

Since I needed to bring back yahoo_convert_to_numeric, I figured I could at
least clean it up a little bit.  Refs #3295.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/util.c	78228f35e1c403abedb0df427c17eaef5d9d21dd
+++ libpurple/protocols/yahoo/util.c	d4205f074414d85a7fdf646c9f56272bb1e15846
@@ -166,15 +166,20 @@ char *yahoo_convert_to_numeric(const cha
 
 char *yahoo_convert_to_numeric(const char *str)
 {
-	char *retstr, buf[7];
+	GString *gstr = NULL;
+	char *retstr;
 	const char *p;
 
-	retstr = (char*)malloc(strlen(str) * 6 + 1);
-	memset(retstr, 0x00, sizeof(retstr));
+	gstr = g_string_sized_new(strlen(str) * 6 + 1);
+
 	for (p = str; *p; p++) {
-		sprintf(buf, "&#%d;", (unsigned char)*p);
-		strcat(retstr, buf);
+		g_string_append_printf(gstr, "&#%u;", *p);
 	}
+
+	retstr = gstr->str;
+
+	g_string_free(gstr, FALSE);
+
 	return retstr;
 }
 


More information about the Commits mailing list