summaryrefslogtreecommitdiff
path: root/src/common/buffer.h
blob: 4d7f46d38aecd0bab1d856b786dd1d28666c75b5 (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