]> 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:03 +0000 (21:17 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 7 Jan 2010 21:17:03 +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.0@238494 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 2d30ba5167baf6279d95314c2f809b4de847816c..5a375c5c0aaf03fa50547be35ca537bc538926de 100644 (file)
@@ -591,9 +591,6 @@ static struct ast_channel *alsa_request(const char *type, int format, void *data
 
 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 ab91131c77dd8b8b628ef5bedade44b7d97a6e5a..c125a66d709fba54f6903f1476300fd788ecd227 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 c9c0c7d4a4627054a4324beaed3486957b16a2d8..e6126d2643e6e3545b2cb7dcf62baca69db30d03 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 1c6fcd3a422ed43a6a8f4492141038ac2077d7bd..062e058981be447678cc7e10889ed71aa24d2787 100644 (file)
@@ -217,10 +217,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 975bf72f23c6879a47be7edb7e3e0de776a86cf7..26d686a8abf6787dfcd29047d911dc423073cb2f 100644 (file)
@@ -252,13 +252,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 */
 static const char *config1 = "usbradio_tune.conf";    /* tune config file */
 
index e3297b0eca7201248b4d78dd0eaf428562a22f04..4ffe8d07c7cb723e09a7d6f98d3d0f35aa4bdd62 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
 \*---------------------------------------------------------------------------*/