mirror of
git://projects.qi-hardware.com/ben-scans.git
synced 2024-11-25 22:59:42 +02:00
16 lines
259 B
C
16 lines
259 B
C
|
#ifndef UTIL_H
|
||
|
#define UTIL_H
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
|
||
|
#define alloc_size(s) \
|
||
|
({ void *alloc_size_tmp = malloc(s); \
|
||
|
if (!alloc_size_tmp) \
|
||
|
abort(); \
|
||
|
alloc_size_tmp; })
|
||
|
|
||
|
#define alloc_type(t) ((t *) alloc_size(sizeof(t)))
|
||
|
|
||
|
#endif /* UTIL_H */
|