|
@@ -2,14 +2,27 @@
|
2
|
2
|
#define STDLIB_H
|
3
|
3
|
|
4
|
4
|
#include <stdint.h>
|
|
5
|
+#include <assert.h>
|
|
6
|
+
|
|
7
|
+/*****************************************************************************
|
|
8
|
+ *
|
|
9
|
+ * Numeric parsing
|
|
10
|
+ *
|
|
11
|
+ ****************************************************************************
|
|
12
|
+ */
|
5
|
13
|
|
6
|
14
|
extern unsigned long strtoul ( const char *p, char **endp, int base );
|
7
|
|
-extern void * realloc ( void *old_ptr, size_t new_size );
|
|
15
|
+
|
|
16
|
+/*****************************************************************************
|
|
17
|
+ *
|
|
18
|
+ * Memory allocation
|
|
19
|
+ *
|
|
20
|
+ ****************************************************************************
|
|
21
|
+ */
|
|
22
|
+
|
8
|
23
|
extern void * malloc ( size_t size );
|
|
24
|
+extern void * realloc ( void *old_ptr, size_t new_size );
|
9
|
25
|
extern void free ( void *ptr );
|
10
|
|
-extern int system ( const char *command );
|
11
|
|
-extern long int random ( void );
|
12
|
|
-
|
13
|
26
|
extern void * _calloc ( size_t len );
|
14
|
27
|
|
15
|
28
|
/**
|
|
@@ -29,4 +42,31 @@ static inline void * calloc ( size_t nmemb, size_t size ) {
|
29
|
42
|
return _calloc ( nmemb * size );
|
30
|
43
|
}
|
31
|
44
|
|
|
45
|
+/*****************************************************************************
|
|
46
|
+ *
|
|
47
|
+ * Random number generation
|
|
48
|
+ *
|
|
49
|
+ ****************************************************************************
|
|
50
|
+ */
|
|
51
|
+
|
|
52
|
+extern long int random ( void );
|
|
53
|
+extern void srandom ( unsigned int seed );
|
|
54
|
+
|
|
55
|
+static inline int rand ( void ) {
|
|
56
|
+ return random();
|
|
57
|
+}
|
|
58
|
+
|
|
59
|
+static inline void srand ( unsigned int seed ) {
|
|
60
|
+ srandom ( seed );
|
|
61
|
+}
|
|
62
|
+
|
|
63
|
+/*****************************************************************************
|
|
64
|
+ *
|
|
65
|
+ * Miscellaneous
|
|
66
|
+ *
|
|
67
|
+ ****************************************************************************
|
|
68
|
+ */
|
|
69
|
+
|
|
70
|
+extern int system ( const char *command );
|
|
71
|
+
|
32
|
72
|
#endif /* STDLIB_H */
|