2006-04-27 Paolo Borelli (pborelli@katamail.com) reviewed by: plam

Make FcStrCopy slightly more efficient.
This commit is contained in:
Patrick Lam 2006-04-28 07:00:25 +00:00
parent 0037aad501
commit 31b7e6d7f5
2 changed files with 14 additions and 5 deletions

View File

@ -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 <plam@mit.edu>
Keith Packard <keithp@keithp.com>
* src/fcstr.c (FcStrBufChar):

View File

@ -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;
}