qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 17/25] audio: remove gcc specific audio_MIN, aud


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH 17/25] audio: remove gcc specific audio_MIN, audio_MAX
Date: Thu, 20 Aug 2015 22:36:22 +0200

Hi

On Thu, Aug 6, 2015 at 8:28 PM, Kővágó, Zoltán <address@hidden> wrote:
> Currently the gcc specific version only evaluates the arguments once,
> while the generic version evaluates one argument twice, which can cause
> debugging headaches when an argument has a side effect.  This patch at
> least provides consistent behavior between compilers.
>

Going this way, you could simply replace audio_MIN/MAX with MIN/MAX
(from osdep.h and glib headers)

Reviewed-by: Marc-André Lureau <address@hidden>


> Signed-off-by: Kővágó, Zoltán <address@hidden>
> ---
>  audio/audio.h | 14 --------------
>  1 file changed, 14 deletions(-)
>
> diff --git a/audio/audio.h b/audio/audio.h
> index 68545b6..3a54e17 100644
> --- a/audio/audio.h
> +++ b/audio/audio.h
> @@ -150,22 +150,8 @@ static inline void *advance (void *p, int incr)
>      return (d + incr);
>  }
>
> -#ifdef __GNUC__
> -#define audio_MIN(a, b) ( __extension__ ({      \
> -    __typeof (a) ta = a;                        \
> -    __typeof (b) tb = b;                        \
> -    ((ta)>(tb)?(tb):(ta));                      \
> -}))
> -
> -#define audio_MAX(a, b) ( __extension__ ({      \
> -    __typeof (a) ta = a;                        \
> -    __typeof (b) tb = b;                        \
> -    ((ta)<(tb)?(tb):(ta));                      \
> -}))
> -#else
>  #define audio_MIN(a, b) ((a)>(b)?(b):(a))
>  #define audio_MAX(a, b) ((a)<(b)?(b):(a))
> -#endif
>
>  int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
>                        int freq, int bits, int nchannels);
> --
> 2.4.5
>
>



-- 
Marc-André Lureau



reply via email to

[Prev in Thread] Current Thread [Next in Thread]