Files
kolibrios/programs/develop/ktcc/trunk/libc.obj/source/stdlib/realloc.c
Egor00f bb59eac8d6
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 1m7s
Build system / Build (pull_request) Successful in 15m52s
libc.obj: update malloc/free/realloc
гавно говна, нужно доработать
2026-01-14 00:03:55 +05:00

17 lines
330 B
C

#include <stdlib.h>
#include <sys/ksys.h>
#include <string.h>
#include "_mem.h"
void* realloc(void* ptr, size_t newsize)
{
void *new_ptr = malloc(newsize);
if(ptr != NULL && new_ptr != NULL)
{
memcpy(new_ptr, ptr, min(newsize, GET_mem_node_HEADER(ptr)->size));
free(ptr);
}
return new_ptr;
}