Browse Source

alloca() can be useful in some (limited) circumstances.

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
79a399c05a
1 changed files with 25 additions and 0 deletions
  1. 25
    0
      src/include/alloca.h

+ 25
- 0
src/include/alloca.h View File

@@ -0,0 +1,25 @@
1
+#ifndef _ALLOCA_H
2
+#define _ALLOCA_H
3
+
4
+/**
5
+ * @file
6
+ *
7
+ * Temporary memory allocation
8
+ *
9
+ */
10
+
11
+#include <stdint.h>
12
+
13
+/**
14
+ * Allocate temporary memory from the stack
15
+ *
16
+ * @v size		Size to allocate
17
+ * @ret ptr		Allocated memory
18
+ *
19
+ * This memory will be freed automatically when the containing
20
+ * function returns.  There are several caveats regarding use of
21
+ * alloca(); use it only if you already know what they are.
22
+ */
23
+#define alloca(size) __builtin_alloca ( size )
24
+
25
+#endif /* _ALLOCA_H */

Loading…
Cancel
Save