Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Git Source Tree
Root/
Source at commit 15067435ae364dafdddbea319c3cc3b020a8a4ba created 11 years 11 months ago. By Werner Almesberger, fakefile/: so far unsuccessful attempt at jailing Kicad | |
---|---|
1 | /* |
2 | * util.h - Utility functions |
3 | * |
4 | * Copyright 2012 by Werner Almesberger |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. |
10 | */ |
11 | |
12 | #ifndef UTIL_H |
13 | #define UTIL_H |
14 | |
15 | #include <stdlib.h> |
16 | |
17 | |
18 | #define alloc_size(s) \ |
19 | ({ void *alloc_size_tmp = malloc(s); \ |
20 | if (!alloc_size_tmp) \ |
21 | abort(); \ |
22 | alloc_size_tmp; }) |
23 | |
24 | #define alloc_type(t) ((t *) alloc_size(sizeof(t))) |
25 | |
26 | #endif /* !UTIL_H */ |
27 |
Branches:
master