]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 209400 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 7 Jan 2010 21:17:32 +0000 (21:17 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 7 Jan 2010 21:17:32 +0000 (21:17 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

........
  r209400 | kpfleming | 2009-07-28 08:49:46 -0500 (Tue, 28 Jul 2009) | 3 lines

  Define side-effect-safe MIN and MAX macros and remove duplicate definitions from various files.
  (closes issue #16251)
  Reported by: asgaroth
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@238497 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 de726ac3f15e50f9ec6fe396896fb4a9e9102bf9..c6814f4adceaf23f567655d4a0c80d95872dde97 100644 (file)
@@ -591,9 +591,6 @@ static struct ast_channel *alsa_request(const char *type, int fmt, void *data, i
 
 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 b057580fb85d26ae172a1754278b6247608f496c..4c9b91a91bfabdabe744632e7e32f7f951738fe9 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 cc29608caa3e68563717972d146956ce99385324..d045e00c1ecd57095fabe90f9e4ab5fe4612fac5 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 6dbe3b30082fa079c446d902d4fba1b1c436b81e..ba9d92bcaddeff1b89b7da70137792c1d9f12fd3 100644 (file)
@@ -243,10 +243,6 @@ static int min_expiry = DEFAULT_MIN_EXPIRY;        /*!< Minimum accepted registr
 static int max_expiry = DEFAULT_MAX_EXPIRY;        /*!< Maximum accepted registration time */
 static int default_expiry = DEFAULT_DEFAULT_EXPIRY;
 
-#ifndef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
 #define CALLERID_UNKNOWN             "Anonymous"
 #define FROMDOMAIN_INVALID           "anonymous.invalid"
 
index 312bc997bd639c0a8b3f6cf073a526b2cc02929b..bc77888d02a3af5e1818dcd86bda1e480e30de36 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 const char *config = "usbradio.conf";   /* default config file */
 #define config1 "usbradio_tune_%s.conf"    /* tune config file */
 
index fcbbdbd394d9bb0a214e766239abd1384214de29..91de914b5c58c54fe7d9f85ebfeef68b0de24ba3 100644 (file)
@@ -220,6 +220,11 @@ void ast_sha1_hash(char *output, 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
 \*---------------------------------------------------------------------------*/