57 lines
1.8 KiB
C
57 lines
1.8 KiB
C
#ifndef _STDLIB_H
|
|
#define _STDLIB_H
|
|
|
|
#include <bits/macros.h>
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
/* Aborts the program. */
|
|
__lc_noreturn void abort(void);
|
|
|
|
/* Normally exits the program with the specified status code. */
|
|
__lc_noreturn void exit(int status);
|
|
|
|
/* Abnormally exits the program with the specified status code. */
|
|
__lc_noreturn void _Exit(int status);
|
|
|
|
/* Registers a handler function to be run at normal program termination. */
|
|
int atexit(void (*handler)(void));
|
|
|
|
/* Returns an integer (of type int) parsed from the string str. */
|
|
int atoi(const char* str);
|
|
|
|
/* Returns an integer (of type long) parsed from the string str. */
|
|
long atol(const char* str);
|
|
|
|
/* Returns an integer (of type long long) parsed from the string str. */
|
|
long long atoll(const char* str);
|
|
|
|
/* Not implemented. */
|
|
char* getenv(const char*);
|
|
|
|
/* Allocates n bytes of memory and returns a pointer to it. This memory should be freed by calling free() when it is
|
|
* not in use anymore. */
|
|
void* malloc(size_t n);
|
|
|
|
/* Allocates enough bytes of memory for an array containing nmemb items of size n and returns a pointer to it. This
|
|
* memory should be freed by calling free() when it is not in use anymore. */
|
|
void* calloc(size_t nmemb, size_t n);
|
|
|
|
/* Resizes memory allocated by malloc() or calloc() to n bytes. Returns a pointer to the new resized region of
|
|
* memory, which should be used instead of the old one. This memory should be freed by calling free() when it is not
|
|
* in use anymore. */
|
|
void* realloc(void* ptr, size_t n);
|
|
|
|
/* Frees a pointer to memory allocated by malloc(), calloc() or realloc(). Accessing the contents of ptr afterwards
|
|
* is undefined behavior. */
|
|
void free(void* ptr);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif |