Branch data Line data Source code
1 : : /* stdlib.h */
2 : :
3 : : /*
4 : : * Copyright (c) 2011-2014 Wind River Systems, Inc.
5 : : *
6 : : * SPDX-License-Identifier: Apache-2.0
7 : : */
8 : :
9 : : #ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDLIB_H_
10 : : #define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDLIB_H_
11 : :
12 : : #include <stddef.h>
13 : : #include <limits.h>
14 : :
15 : : #ifdef __cplusplus
16 : : extern "C" {
17 : : #endif
18 : :
19 : 0 : unsigned long strtoul(const char *nptr, char **endptr, int base);
20 : 0 : long strtol(const char *nptr, char **endptr, int base);
21 : 0 : unsigned long long strtoull(const char *nptr, char **endptr, int base);
22 : 0 : long long strtoll(const char *nptr, char **endptr, int base);
23 : 0 : int atoi(const char *s);
24 : :
25 [ # # ]: 0 : void *malloc(size_t size);
26 : 0 : void free(void *ptr);
27 : 0 : void *calloc(size_t nmemb, size_t size);
28 : 0 : void *realloc(void *ptr, size_t size);
29 : 0 : void *reallocarray(void *ptr, size_t nmemb, size_t size);
30 : :
31 : 0 : void *bsearch(const void *key, const void *array,
32 : : size_t count, size_t size,
33 : : int (*cmp)(const void *key, const void *element));
34 : :
35 : 0 : void qsort_r(void *base, size_t nmemb, size_t size,
36 : : int (*compar)(const void *, const void *, void *), void *arg);
37 : 0 : void qsort(void *base, size_t nmemb, size_t size,
38 : : int (*compar)(const void *, const void *));
39 : :
40 : : #define EXIT_SUCCESS 0
41 : : #define EXIT_FAILURE 1
42 : 0 : void _exit(int status);
43 : : static inline void exit(int status)
44 : : {
45 : : _exit(status);
46 : : }
47 : 0 : void abort(void);
48 : :
49 : : #ifdef CONFIG_MINIMAL_LIBC_RAND
50 : : #define RAND_MAX INT_MAX
51 : : int rand(void);
52 : : void srand(unsigned int seed);
53 : : #endif /* CONFIG_MINIMAL_LIBC_RAND */
54 : :
55 : : static inline int abs(int __n)
56 : : {
57 : : return (__n < 0) ? -__n : __n;
58 : : }
59 : :
60 : : static inline long labs(long __n)
61 : : {
62 : : return (__n < 0L) ? -__n : __n;
63 : : }
64 : :
65 : : static inline long long llabs(long long __n)
66 : : {
67 : : return (__n < 0LL) ? -__n : __n;
68 : : }
69 : :
70 : : #ifdef __cplusplus
71 : : }
72 : : #endif
73 : :
74 : : #endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDLIB_H_ */
|