summaryrefslogtreecommitdiff
path: root/src/common/buffer.h
blob: ea94380ce72b9ca011913f6c55165014def6db3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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