7 /*****************************************************************************
11 ****************************************************************************
14 extern unsigned long strtoul ( const char *p, char **endp, int base );
16 /*****************************************************************************
20 ****************************************************************************
23 extern void * malloc ( size_t size );
24 extern void * realloc ( void *old_ptr, size_t new_size );
25 extern void free ( void *ptr );
26 extern void * zalloc ( size_t len );
29 * Allocate cleared memory
31 * @v nmemb Number of members
32 * @v size Size of each member
33 * @ret ptr Allocated memory
35 * Allocate memory as per malloc(), and zero it.
37 * This is implemented as a static inline, with the body of the
38 * function in zalloc(), since in most cases @c nmemb will be 1 and
39 * doing the multiply is just wasteful.
41 static inline void * calloc ( size_t nmemb, size_t size ) {
42 return zalloc ( nmemb * size );
45 /*****************************************************************************
47 * Random number generation
49 ****************************************************************************
52 extern long int random ( void );
53 extern void srandom ( unsigned int seed );
55 static inline int rand ( void ) {
59 static inline void srand ( unsigned int seed ) {
63 /*****************************************************************************
67 ****************************************************************************
70 extern int system ( const char *command );