summaryrefslogtreecommitdiffstats
path: root/src/include/stdlib.h
diff options
context:
space:
mode:
authorMichael Brown2007-01-19 03:02:59 +0100
committerMichael Brown2007-01-19 03:02:59 +0100
commit4256b3338a414d7f2e63b0be403d362a0782a707 (patch)
tree37832836e5a2df57d5ad8356da68fdddbe680b1a /src/include/stdlib.h
parentvsprintf.h is gPXE-specific; move it to include/gpxe (diff)
downloadipxe-4256b3338a414d7f2e63b0be403d362a0782a707.tar.gz
ipxe-4256b3338a414d7f2e63b0be403d362a0782a707.tar.xz
ipxe-4256b3338a414d7f2e63b0be403d362a0782a707.zip
Split random number generation out into core/random.c, and create the
correct prototypes for srandom(), rand() and srand().
Diffstat (limited to 'src/include/stdlib.h')
-rw-r--r--src/include/stdlib.h48
1 files changed, 44 insertions, 4 deletions
diff --git a/src/include/stdlib.h b/src/include/stdlib.h
index 26b68351..6a0e9163 100644
--- a/src/include/stdlib.h
+++ b/src/include/stdlib.h
@@ -2,14 +2,27 @@
#define STDLIB_H
#include <stdint.h>
+#include <assert.h>
+
+/*****************************************************************************
+ *
+ * Numeric parsing
+ *
+ ****************************************************************************
+ */
extern unsigned long strtoul ( const char *p, char **endp, int base );
-extern void * realloc ( void *old_ptr, size_t new_size );
+
+/*****************************************************************************
+ *
+ * Memory allocation
+ *
+ ****************************************************************************
+ */
+
extern void * malloc ( size_t size );
+extern void * realloc ( void *old_ptr, size_t new_size );
extern void free ( void *ptr );
-extern int system ( const char *command );
-extern long int random ( void );
-
extern void * _calloc ( size_t len );
/**
@@ -29,4 +42,31 @@ static inline void * calloc ( size_t nmemb, size_t size ) {
return _calloc ( nmemb * size );
}
+/*****************************************************************************
+ *
+ * Random number generation
+ *
+ ****************************************************************************
+ */
+
+extern long int random ( void );
+extern void srandom ( unsigned int seed );
+
+static inline int rand ( void ) {
+ return random();
+}
+
+static inline void srand ( unsigned int seed ) {
+ srandom ( seed );
+}
+
+/*****************************************************************************
+ *
+ * Miscellaneous
+ *
+ ****************************************************************************
+ */
+
+extern int system ( const char *command );
+
#endif /* STDLIB_H */