im.pidgin.pidgin: d7ac6b99ef7882ae0af3758b0267dc2a47020712

markdoliner at pidgin.im markdoliner at pidgin.im
Sun Feb 10 04:50:44 EST 2008


-----------------------------------------------------------------
Revision: d7ac6b99ef7882ae0af3758b0267dc2a47020712
Ancestor: e67f992dbbac76473bada603b957a38737723832
Author: markdoliner at pidgin.im
Date: 2008-02-10T09:45:37
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d7ac6b99ef7882ae0af3758b0267dc2a47020712

Modified files:
        libpurple/protocols/oscar/oscar.c

ChangeLog: 

A patch from oliver to speed up oscar's normalize function a little by
removing a call to strncpy().
Fixes #4816.

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	ded5172ee9cf4c4452583e5a80220e019b331a2e
+++ libpurple/protocols/oscar/oscar.c	3f9ab0ed0ed3f899ddc1032fea48391b9b04e4cb
@@ -6609,18 +6609,18 @@ oscar_normalize(const PurpleAccount *acc
 
 	g_return_val_if_fail(str != NULL, NULL);
 
-	strncpy(buf, str, BUF_LEN);
-	for (i=0, j=0; buf[j]; i++, j++)
+	/* copy str to buf and skip all blanks */
+	for (i=0, j=0; str[j] && i < BUF_LEN; i++, j++)
 	{
-		while (buf[j] == ' ')
+		while (str[j] == ' ')
 			j++;
-		buf[i] = buf[j];
+		buf[i] = str[j];
 	}
 	buf[i] = '\0';
 
 	tmp1 = g_utf8_strdown(buf, -1);
 	tmp2 = g_utf8_normalize(tmp1, -1, G_NORMALIZE_DEFAULT);
-	g_snprintf(buf, sizeof(buf), "%s", tmp2);
+	strcpy(buf, tmp2);
 	g_free(tmp2);
 	g_free(tmp1);
 


More information about the Commits mailing list