summaryrefslogtreecommitdiff
path: root/firmware/libc/include/stdlib.h
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-05-06 21:04:40 +0000
committerThomas Martitz <kugel@rockbox.org>2010-05-06 21:04:40 +0000
commit50a6ca39ad4ed01922aa4f755f0ca579788226cf (patch)
treec7881b015b220558167310345b162324c96be15a /firmware/libc/include/stdlib.h
parentadb506df14aded06ed6e9ebf8540e6fd383ffd6a (diff)
downloadrockbox-50a6ca39ad4ed01922aa4f755f0ca579788226cf.tar.gz
rockbox-50a6ca39ad4ed01922aa4f755f0ca579788226cf.zip
Move c/h files implementing/defining standard library stuff into a new libc directory, also standard'ify some parts of the code base (almost entirely #include fixes).
This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/libc/include/stdlib.h')
-rw-r--r--firmware/libc/include/stdlib.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/firmware/libc/include/stdlib.h b/firmware/libc/include/stdlib.h
new file mode 100644
index 0000000000..5f6db6da8a
--- /dev/null
+++ b/firmware/libc/include/stdlib.h
@@ -0,0 +1,58 @@
1/*
2 * stdlib.h
3 *
4 * Definitions for common types, variables, and functions.
5 */
6
7#ifndef _STDLIB_H_
8#ifdef __cplusplus
9extern "C" {
10#endif
11#define _STDLIB_H_
12
13#include "_ansi.h"
14
15#define __need_size_t
16#define __need_wchar_t
17#include <stddef.h>
18
19#ifndef NULL
20#define NULL ((void*)0)
21#endif
22
23#define EXIT_FAILURE 1
24#define EXIT_SUCCESS 0
25
26_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR)));
27
28void *malloc(size_t);
29void *calloc (size_t nmemb, size_t size);
30void free(void *);
31void *realloc(void *, size_t);
32
33#define RAND_MAX INT_MAX
34
35void srand(unsigned int seed);
36int rand(void);
37
38#ifndef ABS
39#if defined(__GNUC__)
40#define ABS(a) ({typeof (a) ___a = (a); ___a < 0 ? -___a: ___a; })
41#else
42#define ABS(a) (((a) < 0) ? -(a) : (a))
43#endif /* __GNUC__ */
44#endif
45
46#define abs(x) ((int)ABS(x))
47#define labs(x) ((long)abs(x))
48
49#ifdef SIMULATOR
50void exit(int status);
51#endif
52
53int atoi (const char *str);
54
55#ifdef __cplusplus
56}
57#endif
58#endif /* _STDLIB_H_ */