aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_alsa.c3
-rw-r--r--channels/chan_console.c7
-rw-r--r--channels/chan_oss.c7
-rw-r--r--channels/chan_sip.c4
-rw-r--r--channels/chan_usbradio.c7
-rw-r--r--include/asterisk/utils.h5
-rw-r--r--main/poll.c8
7 files changed, 5 insertions, 36 deletions
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index 2d30ba516..5a375c5c0 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -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)))
diff --git a/channels/chan_console.c b/channels/chan_console.c
index ab91131c7..c125a66d7 100644
--- a/channels/chan_console.c
+++ b/channels/chan_console.c
@@ -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"
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index c9c0c7d4a..e6126d264 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -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;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 1c6fcd3a4..062e05898 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -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"
diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c
index 975bf72f2..26d686a8a 100644
--- a/channels/chan_usbradio.c
+++ b/channels/chan_usbradio.c
@@ -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 */
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index e3297b0ec..4ffe8d07c 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -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
diff --git a/main/poll.c b/main/poll.c
index bb93125a6..62e681dca 100644
--- a/main/poll.c
+++ b/main/poll.c
@@ -84,14 +84,6 @@
#ifdef AST_POLL_COMPAT
/*---------------------------------------------------------------------------*\
- Macros
-\*---------------------------------------------------------------------------*/
-
-#ifndef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-/*---------------------------------------------------------------------------*\
Private Functions
\*---------------------------------------------------------------------------*/