Dolda2000 GitWeb
/
ashd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9aee4cb
)
Added max and min macros.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Wed, 17 Dec 2008 02:05:58 +0000
(
03:05
+0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Wed, 17 Dec 2008 02:05:58 +0000
(
03:05
+0100)
lib/utils.h
patch
|
blob
|
blame
|
history
diff --git
a/lib/utils.h
b/lib/utils.h
index
4f85743
..
6b1df4e
100644
(file)
--- a/
lib/utils.h
+++ b/
lib/utils.h
@@
-3,6
+3,9
@@
#include <stdarg.h>
+#define max(a, b) (((b) > (a))?(b):(a))
+#define min(a, b) (((b) < (a))?(b):(a))
+
#define smalloc(size) ({void *__result__; ((__result__ = malloc(size)) == NULL)?({exit(-1); (void *)0;}):__result__;})
#define srealloc(ptr, size) ({void *__result__; ((__result__ = realloc((ptr), (size))) == NULL)?({exit(-1); (void *)0;}):__result__;})
#define szmalloc(size) memset(smalloc(size), 0, size)