* PERFORMANCE OF THIS SOFTWARE.
*/
+#include "fcint.h"
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
-#include "fcint.h"
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;
}
++ s1;
++ s2;
}
-
- return 0;
+ /* never reached. */
}
int
}
else
{
- size = buf->size + 1024;
+ size = buf->size + 64;
new = malloc (size);
if (new)
{
if (!new)
return 0;
FcMemAlloc (FC_MEM_STRING, size);
- strcpy ((char *) new, (const char *) s);
+ memcpy (new, s, size);
}
return new;
}