alloca() can be useful in some (limited) circumstances.
authorMichael Brown <mcb30@etherboot.org>
Thu, 11 Jan 2007 23:19:31 +0000 (23:19 +0000)
committerMichael Brown <mcb30@etherboot.org>
Thu, 11 Jan 2007 23:19:31 +0000 (23:19 +0000)
src/include/alloca.h [new file with mode: 0644]

diff --git a/src/include/alloca.h b/src/include/alloca.h
new file mode 100644 (file)
index 0000000..08398fb
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef _ALLOCA_H
+#define _ALLOCA_H
+
+/**
+ * @file
+ *
+ * Temporary memory allocation
+ *
+ */
+
+#include <stdint.h>
+
+/**
+ * Allocate temporary memory from the stack
+ *
+ * @v size             Size to allocate
+ * @ret ptr            Allocated memory
+ *
+ * This memory will be freed automatically when the containing
+ * function returns.  There are several caveats regarding use of
+ * alloca(); use it only if you already know what they are.
+ */
+#define alloca(size) __builtin_alloca ( size )
+
+#endif /* _ALLOCA_H */