- add additional error checks

git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@63 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
stefan 2010-08-10 20:32:36 +00:00
parent ce3c5e3d57
commit 5295579209

View file

@ -69,6 +69,9 @@ char* strncpy(char *dest, const char *src, size_t n)
{
size_t i;
if (BUILTIN_EXPECT(!dest || !src, 0))
return dest;
for (i = 0 ; i < n && src[i] != '\0' ; i++)
dest[i] = src[i];
if (i < n)
@ -85,6 +88,9 @@ char* strcpy(char *dest, const char *src)
{
size_t i;
if (BUILTIN_EXPECT(!dest || !src, 0))
return dest;
for (i = 0 ; src[i] != '\0' ; i++)
dest[i] = src[i];
dest[i] = '\0';