diff options
Diffstat (limited to 'src/common/buffer.h')
-rw-r--r-- | src/common/buffer.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/buffer.h b/src/common/buffer.h new file mode 100644 index 000000000..294233595 --- /dev/null +++ b/src/common/buffer.h @@ -0,0 +1,18 @@ +#ifndef _BUFFER_H_
+#define _BUFFER_H_
+
+// Full credit for this goes to Shinomori [Ajarn]
+
+#ifdef __GNUC__ // GCC has variable length arrays
+
+#define CREATE_BUFFER(name, type, size) type name[size]
+#define DELETE_BUFFER(name)
+
+#else // others don't, so we emulate them
+
+#define CREATE_BUFFER(name, type, size) type *name=(type*)aCalloc(size,sizeof(type))
+#define DELETE_BUFFER(name) aFree(name);name=NULL
+
+#endif
+
+#endif
\ No newline at end of file |