Revert "mlibc: Use memmove in realloc."

This reverts commit f47a21e3cb4814c4a30d10ff59e5c947441725e9.
This commit is contained in:
Jan Nieuwenhuizen 2018-04-21 13:42:16 +02:00
parent 1270c767cd
commit 7cad0671f3
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 13 additions and 13 deletions

View file

@ -134,6 +134,18 @@ localtime (time_t const *timep)
return 0;
}
void *
memmove (void *dest, void const *src, size_t n)
{
if (dest < src)
return memcpy (dest, src, n);
char *p = dest + n;
char const *q = src +n;
while (n--)
*--p = *--q;
return dest;
}
void *
memset (void *s, int c, size_t n)
{

View file

@ -294,25 +294,13 @@ memcpy (void *dest, void const *src, size_t n)
return dest;
}
void *
memmove (void *dest, void const *src, size_t n)
{
if (dest < src)
return memcpy (dest, src, n);
char *p = dest + n;
char const *q = src +n;
while (n--)
*--p = *--q;
return dest;
}
void *
realloc (void *ptr, size_t size)
{
void *new = malloc (size);
if (ptr && new)
{
memmove (new, ptr, size);
memcpy (new, ptr, size);
free (ptr);
}
return new;