summaryrefslogtreecommitdiffstats
path: root/src/include/stdlib.h
diff options
context:
space:
mode:
authorMichael Brown2006-12-02 21:10:21 +0100
committerMichael Brown2006-12-02 21:10:21 +0100
commit3e0286dee3ae01047666f4944d304dbbee2e58a5 (patch)
treed3b73373076517d5fa2e5b1894dba668ba6f5c0e /src/include/stdlib.h
parentBasic non-volatile storage support (diff)
downloadipxe-3e0286dee3ae01047666f4944d304dbbee2e58a5.tar.gz
ipxe-3e0286dee3ae01047666f4944d304dbbee2e58a5.tar.xz
ipxe-3e0286dee3ae01047666f4944d304dbbee2e58a5.zip
Move ANSI C standard prototypes to stdlib.h; leave the gPXE-specific
function prototypes (e.g. malloc_dma()) in malloc.h.
Diffstat (limited to 'src/include/stdlib.h')
-rw-r--r--src/include/stdlib.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/include/stdlib.h b/src/include/stdlib.h
index 4dd7e54c..a7dd1d83 100644
--- a/src/include/stdlib.h
+++ b/src/include/stdlib.h
@@ -2,5 +2,25 @@
#define STDLIB_H
extern unsigned long strtoul ( const char *p, char **endp, int base );
+extern void * realloc ( void *old_ptr, size_t new_size );
+extern void * malloc ( size_t size );
+extern void free ( void *ptr );
+
+/**
+ * Allocate cleared memory
+ *
+ * @v nmemb Number of members
+ * @v size Size of each member
+ * @ret ptr Allocated memory
+ *
+ * Allocate memory as per malloc(), and zero it.
+ *
+ * Note that malloc() and calloc() are identical, in the interests of
+ * reducing code size. Callers should not, however, rely on malloc()
+ * clearing memory, since this behaviour may change in future.
+ */
+static inline void * calloc ( size_t nmemb, size_t size ) {
+ return malloc ( nmemb * size );
+}
#endif /* STDLIB_H */