From: Patrick Lam Date: Fri, 28 Apr 2006 07:00:25 +0000 (+0000) Subject: 2006-04-27 Paolo Borelli (pborelli@katamail.com) reviewed by: plam X-Git-Tag: 2.3.96~56 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=31b7e6d7f58616ebdc6281c3230282a2d7b57d6d;p=fontconfig.git 2006-04-27 Paolo Borelli (pborelli@katamail.com) reviewed by: plam Make FcStrCopy slightly more efficient. --- diff --git a/ChangeLog b/ChangeLog index 912520c..52ac61d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-04-27 Paolo Borelli (pborelli@katamail.com) + reviewed by: plam + + * src/fcstr.c (FcStrCopy): + + Make FcStrCopy slightly more efficient. + 2006-04-27 Patrick Lam Keith Packard * src/fcstr.c (FcStrBufChar): diff --git a/src/fcstr.c b/src/fcstr.c index e75ecb9..5d1961c 100644 --- a/src/fcstr.c +++ b/src/fcstr.c @@ -30,15 +30,17 @@ FcChar8 * FcStrCopy (const FcChar8 *s) { - FcChar8 *r; + int len; + FcChar8 *r; if (!s) return 0; - r = (FcChar8 *) malloc (strlen ((char *) s) + 1); + len = strlen ((char *) s) + 1; + r = (FcChar8 *) malloc (len); if (!r) return 0; - FcMemAlloc (FC_MEM_STRING, strlen ((char *) s) + 1); - strcpy ((char *) r, (char *) s); + FcMemAlloc (FC_MEM_STRING, len); + memcpy (r, s, len); return r; } @@ -780,7 +782,7 @@ FcStrCopyFilename (const FcChar8 *s) if (!new) return 0; FcMemAlloc (FC_MEM_STRING, size); - strcpy ((char *) new, (const char *) s); + memcpy (new, s, size); } return new; }