]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Define side-effect-safe MIN and MAX macros and remove duplicate definitions from...
authorKevin P. Fleming <kpfleming@digium.com>
Tue, 28 Jul 2009 13:49:46 +0000 (13:49 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Tue, 28 Jul 2009 13:49:46 +0000 (13:49 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@209400 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_alsa.c
channels/chan_console.c
channels/chan_oss.c
channels/chan_sip.c
channels/chan_usbradio.c
include/asterisk/utils.h
main/poll.c

index 48d718682eb26e76ec240f3e333ebd1d9af4325d..ffc62c8b1c0d1550e41fcee070d8c0888f49604b 100644 (file)
@@ -591,9 +591,6 @@ static struct ast_channel *alsa_request(const char *type, int fmt, const struct
 
 static char *autoanswer_complete(const char *line, const char *word, int pos, int state)
 {
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
        switch (state) {
                case 0:
                        if (!ast_strlen_zero(word) && !strncasecmp(word, "on", MIN(strlen(word), 2)))
index 55be76895c0c6b2c1e89d6abc209bf784d5e0c32..836895ac0bc8667f03142f42411927f98de02b9c 100644 (file)
@@ -101,13 +101,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
  */
 #define TEXT_SIZE      256
 
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-#ifndef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
 /*! \brief Dance, Kirby, Dance! @{ */
 #define V_BEGIN " --- <(\"<) --- "
 #define V_END   " --- (>\")> ---\n"
index 9b2201a48ed578aad26b4fd7d3b729a573ae97e6..a58c4b6d472dca5d68ced519e6eb1f9c5c0c1243 100644 (file)
@@ -229,13 +229,6 @@ END_CONFIG
 #define DEV_DSP "/dev/dsp"
 #endif
 
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-#ifndef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
 static char *config = "oss.conf";      /* default config file */
 
 static int oss_debug;
index 4d89ae03cb68442797f209b102a5fdf69a389ebd..6b9f39a14bb5ea68dbe5032ab4af2620f093fd06 100644 (file)
@@ -557,10 +557,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #define TRUE     1
 #endif
 
-#ifndef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
 /* Arguments for find_peer */
 #define FINDUSERS (1 << 0)
 #define FINDPEERS (1 << 1)
index b8e9d70a979a473ed6ddc7627f6f28a26be1507d..dd19334832594f6f747595bb5877e04a9bfdec11 100644 (file)
@@ -351,13 +351,6 @@ END_CONFIG
 #define DEV_DSP "/dev/dsp"
 #endif
 
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-#ifndef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
 static char *config = "usbradio.conf"; /* default config file */
 static char *config1 = "usbradio_tune_%s.conf";    /* tune config file */
 
index 6f9684409e6b714e3097c953e5524df7c4859b2c..0517485100ab8d5ac90667d30240bce4cd4d7473 100644 (file)
@@ -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
index bb93125a6b03a23285860b10674564a312919138..62e681dca872a2f24b16e21741f4f1fa83a13acd 100644 (file)
 
 #ifdef AST_POLL_COMPAT
 
-/*---------------------------------------------------------------------------*\
-                                 Macros
-\*---------------------------------------------------------------------------*/
-
-#ifndef MAX
-#define MAX(a,b)       ((a) > (b) ? (a) : (b))
-#endif
-
 /*---------------------------------------------------------------------------*\
                             Private Functions
 \*---------------------------------------------------------------------------*/