Mercurial > pidgin.yaz
changeset 22283:2222a596340f
A patch from oliver to speed up oscar's normalize function a little by
removing a call to strncpy().
Fixes #4816.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 10 Feb 2008 09:45:37 +0000 |
parents | f8dde302fcb2 |
children | 5411ca13b878 |
files | libpurple/protocols/oscar/oscar.c |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c Sat Feb 09 09:04:39 2008 +0000 +++ b/libpurple/protocols/oscar/oscar.c Sun Feb 10 09:45:37 2008 +0000 @@ -6609,18 +6609,18 @@ 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);