summaryrefslogtreecommitdiff
path: root/include/asterisk/utils.h
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2009-07-28 13:49:46 +0000
committerKevin P. Fleming <kpfleming@digium.com>2009-07-28 13:49:46 +0000
commitba020fc3909c1b241358d789be991c039452749c (patch)
tree0325381f58fd6b2bc0bddffcc3e553dbd4f8ad8e /include/asterisk/utils.h
parentb3090ee28a707aea02ec0dc1adc72dab66f17431 (diff)
Define side-effect-safe MIN and MAX macros and remove duplicate definitions from various files.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@209400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/utils.h')
-rw-r--r--include/asterisk/utils.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 6f9684409..051748510 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -222,6 +222,11 @@ void ast_sha1_hash(char *output, const char *input);
int ast_base64encode_full(char *dst, const unsigned char *src, int srclen, int max, int linebreaks);
+#undef MIN
+#define MIN(a, b) ({ typeof(a) __a = (a); typeof(b) __b = (b); ((__a > __b) ? __b : __a);})
+#undef MAX
+#define MAX(a, b) ({ typeof(a) __a = (a); typeof(b) __b = (b); ((__a < __b) ? __b : __a);})
+
/*!
* \brief Encode data in base64
* \param dst the destination buffer