[asterisk-commits] kpfleming: trunk r209400 - in /trunk: channels/ include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 28 08:49:50 CDT 2009
Author: kpfleming
Date: Tue Jul 28 08:49:46 2009
New Revision: 209400
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=209400
Log:
Define type-safe MIN and MAX macros and remove duplicate definitions from various files.
Modified:
trunk/channels/chan_alsa.c
trunk/channels/chan_console.c
trunk/channels/chan_oss.c
trunk/channels/chan_sip.c
trunk/channels/chan_usbradio.c
trunk/include/asterisk/utils.h
trunk/main/poll.c
Modified: trunk/channels/chan_alsa.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_alsa.c?view=diff&rev=209400&r1=209399&r2=209400
==============================================================================
--- trunk/channels/chan_alsa.c (original)
+++ trunk/channels/chan_alsa.c Tue Jul 28 08:49:46 2009
@@ -591,9 +591,6 @@
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)))
Modified: trunk/channels/chan_console.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_console.c?view=diff&rev=209400&r1=209399&r2=209400
==============================================================================
--- trunk/channels/chan_console.c (original)
+++ trunk/channels/chan_console.c Tue Jul 28 08:49:46 2009
@@ -100,13 +100,6 @@
* that defines the maximum length of a text message.
*/
#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 " --- <(\"<) --- "
Modified: trunk/channels/chan_oss.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_oss.c?view=diff&rev=209400&r1=209399&r2=209400
==============================================================================
--- trunk/channels/chan_oss.c (original)
+++ trunk/channels/chan_oss.c Tue Jul 28 08:49:46 2009
@@ -227,13 +227,6 @@
#define DEV_DSP "/dev/audio"
#else
#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 */
Modified: trunk/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=209400&r1=209399&r2=209400
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Jul 28 08:49:46 2009
@@ -557,10 +557,6 @@
#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)
Modified: trunk/channels/chan_usbradio.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_usbradio.c?view=diff&rev=209400&r1=209399&r2=209400
==============================================================================
--- trunk/channels/chan_usbradio.c (original)
+++ trunk/channels/chan_usbradio.c Tue Jul 28 08:49:46 2009
@@ -349,13 +349,6 @@
#define DEV_DSP "/dev/audio"
#else
#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 */
Modified: trunk/include/asterisk/utils.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/include/asterisk/utils.h?view=diff&rev=209400&r1=209399&r2=209400
==============================================================================
--- trunk/include/asterisk/utils.h (original)
+++ trunk/include/asterisk/utils.h Tue Jul 28 08:49:46 2009
@@ -221,6 +221,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
Modified: trunk/main/poll.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/poll.c?view=diff&rev=209400&r1=209399&r2=209400
==============================================================================
--- trunk/main/poll.c (original)
+++ trunk/main/poll.c Tue Jul 28 08:49:46 2009
@@ -82,14 +82,6 @@
#include "asterisk/poll-compat.h" /* this package */
#ifdef AST_POLL_COMPAT
-
-/*---------------------------------------------------------------------------*\
- Macros
-\*---------------------------------------------------------------------------*/
-
-#ifndef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
/*---------------------------------------------------------------------------*\
Private Functions
More information about the asterisk-commits
mailing list