2016-05-05 11:49:05 +02:00
|
|
|
#ifndef _STDLIB_H
|
|
|
|
#define _STDLIB_H 1
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
// Common exit codes.
|
|
|
|
#define EXIT_SUCCESS 1
|
|
|
|
#define EXIT_FAILURE 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---
|
|
|
|
// Program exit functions.
|
|
|
|
//---
|
|
|
|
|
|
|
|
/*
|
|
|
|
abort()
|
|
|
|
Aborts the program execution without calling the exit handlers.
|
|
|
|
*/
|
|
|
|
void abort(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
exit()
|
|
|
|
Stops the program execution with the given status code, after calling
|
|
|
|
the exit handlers.
|
|
|
|
*/
|
|
|
|
void exit(int status);
|
|
|
|
|
2016-05-20 22:04:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
//---
|
|
|
|
// Dynamic storage allocation.
|
|
|
|
//---
|
|
|
|
|
|
|
|
/*
|
|
|
|
malloc()
|
2016-07-14 21:10:51 +02:00
|
|
|
Allocates 'size' bytes and returns a pointer to a free memory area.
|
2016-05-20 22:04:15 +02:00
|
|
|
Returns NULL on error.
|
|
|
|
*/
|
|
|
|
void *malloc(size_t size);
|
|
|
|
|
|
|
|
/*
|
|
|
|
calloc()
|
2016-07-14 21:10:51 +02:00
|
|
|
Allocates 'n' elements of size 'size' and wipes the memory area.
|
|
|
|
Returns NULL on error.
|
2016-05-20 22:04:15 +02:00
|
|
|
*/
|
|
|
|
void *calloc(size_t n, size_t size);
|
|
|
|
|
|
|
|
/*
|
|
|
|
free()
|
|
|
|
Frees a memory block allocated with malloc().
|
|
|
|
*/
|
|
|
|
void free(void *ptr);
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-05 11:49:05 +02:00
|
|
|
#endif // _STDLIB_H
|