diff options
Diffstat (limited to 'src/stdlib/malloc.c')
-rw-r--r-- | src/stdlib/malloc.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/stdlib/malloc.c b/src/stdlib/malloc.c new file mode 100644 index 00000000..b2116fa7 --- /dev/null +++ b/src/stdlib/malloc.c @@ -0,0 +1,23 @@ +#include <stdlib.h> + +/** allocate memory **/ +void * malloc(size_t size) +{ + if (size == 0) { + return NULL; + } + + return realloc(NULL, size); +} + +/*** +allocates ARGUMENT(size) bytes of memory. +***/ + +/* +UNSPECIFIED(The order and contiguity of space allocated by success calls) +IMPLEMENTATION(What is returned if ARGUMENT(size) is 0) +RETURN_FAILURE(CONSTANT(NULL)) +RETURN_SUCCESS(a pointer to the allocated space) +STDC(1) +*/ |