strongswan.org
Wiki/Project Management
Downloads
Gitweb
projects
/
strongswan.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8f68b72
)
Added side effect free min and max macros.
author
Tobias Brunner
<tobias@strongswan.org>
Tue, 25 Aug 2009 11:11:42 +0000
(13:11 +0200)
committer
Tobias Brunner
<tobias@strongswan.org>
Tue, 1 Sep 2009 10:50:50 +0000
(12:50 +0200)
src/libstrongswan/utils.h
patch
|
blob
|
history
diff --git
a/src/libstrongswan/utils.h
b/src/libstrongswan/utils.h
index
6b0990f
..
35008f4
100644
(file)
--- a/
src/libstrongswan/utils.h
+++ b/
src/libstrongswan/utils.h
@@
-72,12
+72,19
@@
/**
* Macro gives back larger of two values.
*/
-#define max(x,y) ((x) > (y) ? (x):(y))
+#define max(x,y) ({ \
+ typeof(x) _x = (x); \
+ typeof(y) _y = (y); \
+ _x > _y ? _x : _y; })
+
/**
* Macro gives back smaller of two values.
*/
-#define min(x,y) ((x) < (y) ? (x):(y))
+#define min(x,y) ({ \
+ typeof(x) _x = (x); \
+ typeof(y) _y = (y); \
+ _x < _y ? _x : _y; })
/**
* Call destructor of an object, if object != NULL