mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Use malloc in memmove instead of operator new.
This commit is contained in:
parent
fc8d64013d
commit
c26cb897a0
1 changed files with 3 additions and 2 deletions
|
@ -23,6 +23,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
// TODO: This is a hacky implementation!
|
// TODO: This is a hacky implementation!
|
||||||
|
@ -30,9 +31,9 @@ extern "C" void* memmove(void* _dest, const void* _src, size_t n)
|
||||||
{
|
{
|
||||||
uint8_t* dest = (uint8_t*) _dest;
|
uint8_t* dest = (uint8_t*) _dest;
|
||||||
const uint8_t* src = (const uint8_t*) _src;
|
const uint8_t* src = (const uint8_t*) _src;
|
||||||
uint8_t* tmp = new uint8_t[n];
|
uint8_t* tmp = (uint8_t*) malloc(n);
|
||||||
memcpy(tmp, src, n);
|
memcpy(tmp, src, n);
|
||||||
memcpy(dest, tmp, n);
|
memcpy(dest, tmp, n);
|
||||||
delete[] tmp;
|
free(tmp);
|
||||||
return _dest;
|
return _dest;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue