2020-09-17 19:27:01 +02:00
|
|
|
#ifndef __LIB_STDLIB_H__
|
|
|
|
# define __LIB_STDLIB_H__
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2020-10-14 11:45:08 +02:00
|
|
|
//---
|
|
|
|
// Dynamic memory management
|
|
|
|
//---
|
|
|
|
/* Allocate SIZE bytes of memory. */
|
2020-09-17 19:27:01 +02:00
|
|
|
extern void *malloc(size_t size);
|
2020-10-14 11:45:08 +02:00
|
|
|
|
|
|
|
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
|
2020-09-17 19:27:01 +02:00
|
|
|
extern void *calloc(size_t nmemb, size_t size);
|
2020-10-14 11:45:08 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
** Re-allocate the previously allocated block in PTR, making the new block
|
|
|
|
** SIZE bytes long.
|
|
|
|
*/
|
2020-09-17 19:27:01 +02:00
|
|
|
extern void *realloc(void *ptr, size_t size);
|
2020-10-14 11:45:08 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
** Re-allocate the previously allocated block in PTR, making the new block large
|
|
|
|
** enough for NMEMB elements of SIZE bytes each.
|
|
|
|
*/
|
2020-09-17 19:27:01 +02:00
|
|
|
extern void *reallocarray(void *ptr, size_t nmemb, size_t size);
|
2020-10-14 11:45:08 +02:00
|
|
|
|
|
|
|
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
|
2020-09-17 19:27:01 +02:00
|
|
|
extern void free(void *ptr);
|
|
|
|
|
|
|
|
#endif /*__LIB_STDLIB_H__*/
|