mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-12 21:09:00 +00:00
Define side-effect-safe MIN and MAX macros and remove duplicate definitions from various files.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@209400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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)))
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -83,14 +83,6 @@
|
||||
|
||||
#ifdef AST_POLL_COMPAT
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Macros
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Private Functions
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user