[FFmpeg-devel] [PATCH] ffplay: compact expression in compute_mod()

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon Apr 11 11:13:22 CEST 2011


Prefer "return X ? Y : Z" over "if (x) return Y; else return Z",
reduce line count.

Signed-off-by: Stefano Sabatini <stefano.sabatini-lala at poste.it>
---
 ffplay.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 04e0343..a5f3b70 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -772,10 +772,7 @@ static void video_image_display(VideoState *is)
 static inline int compute_mod(int a, int b)
 {
     a = a % b;
-    if (a >= 0)
-        return a;
-    else
-        return a + b;
+    return a >= 0 ? a : a + b;
 }
 
 static void video_audio_display(VideoState *s)
-- 
1.7.2.3



More information about the ffmpeg-devel mailing list