2015-04-11 07:44:37 +08:00
|
|
|
/* stdlib.h */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2011-2014 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDLIB_H_
|
|
|
|
#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDLIB_H_
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2016-09-13 10:19:07 +08:00
|
|
|
#include <stddef.h>
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-03-27 22:13:40 +08:00
|
|
|
unsigned long strtoul(const char *nptr, char **endptr, int base);
|
|
|
|
long strtol(const char *nptr, char **endptr, int base);
|
2015-07-31 18:57:00 +08:00
|
|
|
int atoi(const char *s);
|
2015-07-31 18:57:00 +08:00
|
|
|
|
2018-07-13 06:00:58 +08:00
|
|
|
void *malloc(size_t size);
|
|
|
|
void free(void *ptr);
|
|
|
|
void *calloc(size_t nmemb, size_t size);
|
|
|
|
void *realloc(void *ptr, size_t size);
|
|
|
|
void *reallocarray(void *ptr, size_t nmemb, size_t size);
|
|
|
|
|
2019-04-20 14:43:35 +08:00
|
|
|
void *bsearch(const void *key, const void *array,
|
|
|
|
size_t count, size_t size,
|
|
|
|
int (*cmp)(const void *key, const void *element));
|
|
|
|
|
2019-05-23 17:04:31 +08:00
|
|
|
#define EXIT_SUCCESS 0
|
|
|
|
#define EXIT_FAILURE 1
|
|
|
|
void _exit(int status);
|
|
|
|
static inline void exit(int status)
|
|
|
|
{
|
|
|
|
_exit(status);
|
|
|
|
}
|
2020-10-26 20:36:28 +08:00
|
|
|
void abort(void);
|
2019-05-23 17:04:31 +08:00
|
|
|
|
2019-03-03 21:46:02 +08:00
|
|
|
int rand(void);
|
|
|
|
|
2020-11-19 04:42:37 +08:00
|
|
|
static inline int abs(int __n)
|
|
|
|
{
|
|
|
|
return (__n < 0) ? -__n : __n;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline long labs(long __n)
|
|
|
|
{
|
|
|
|
return (__n < 0L) ? -__n : __n;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline long long llabs(long long __n)
|
|
|
|
{
|
|
|
|
return (__n < 0LL) ? -__n : __n;
|
|
|
|
}
|
2018-01-23 23:16:04 +08:00
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2015-07-31 18:57:00 +08:00
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDLIB_H_ */
|