51 lines
1.7 KiB
C
51 lines
1.7 KiB
C
// Copyright (c) 2025, Zak Fenton
|
|
// Zak Fenton's libc is licensed under the Mulan PSL v2. You can use this
|
|
// software according to the terms and conditions of the Mulan PSL v2.
|
|
// You may obtain a copy of Mulan PSL v2 at:
|
|
// http://license.coscl.org.cn/MulanPSL2
|
|
// THIS SOFTWARE IS PROVIDED ON AN “AS IS” BASIS, WITHOUT warranties of
|
|
// any kind, either express or implied, including but not limited to
|
|
// non-infringement, merchantability or fit for a particular purpose.
|
|
// See the Mulan PSL v2 for more details.
|
|
|
|
#ifndef _LIBC_STDLIB_H
|
|
#define _LIBC_STDLIB_H
|
|
|
|
#include <stddef.h>
|
|
|
|
// By default, this libc includes both traditional and garbage collected
|
|
// memory managers. _libc_gcalloc is therefore preconfigured as a malloc
|
|
// alternative with garbage collection, but internally
|
|
// malloc/calloc/realloc/free are also just wrappers over a flexible
|
|
// memory manager.
|
|
|
|
void* malloc(size_t sz);
|
|
void* calloc(size_t n, size_t sz);
|
|
void* realloc(void* mem, size_t sz);
|
|
void free(void* mem);
|
|
void* _libc_gcalloc(size_t sz);
|
|
char* getenv(const char* key);
|
|
int setenv(const char* key, const char* value, int overwrite);
|
|
int unsetenv(const char* key);
|
|
void exit(int x);
|
|
void abort();
|
|
|
|
long strtol(const char* str, char**endvar, int base);
|
|
long long strtoll(const char* str, char**endvar, int base);
|
|
unsigned long strtoul(const char* str, char**endvar, int base);
|
|
unsigned long long strtoull(const char* str, char**endvar, int base);
|
|
|
|
float strtof(const char* str, char**endvar);
|
|
double strtod(const char* str, char**endvar);
|
|
long double strtold(const char* str, char**endvar);
|
|
|
|
double atof(const char* str);
|
|
int atoi(const char* str);
|
|
|
|
int rand();
|
|
void srand(unsigned int r);
|
|
#define RAND_MAX 999999999
|
|
|
|
/* From ifndef at top of file: */
|
|
#endif
|