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