From e85bcc12233ee08b7609382372dd80482fd016f2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 25 Feb 2015 22:23:31 +0100 Subject: cache: use MPCLAMP() macro --- stream/cache.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/stream/cache.c b/stream/cache.c index 8051bfa5e7..fafd76a4ab 100644 --- a/stream/cache.c +++ b/stream/cache.c @@ -126,13 +126,6 @@ enum { FILL_LIMIT = 16 * 1024, }; -static int64_t mp_clipi64(int64_t val, int64_t min, int64_t max) -{ - val = FFMIN(val, max); - val = FFMAX(val, min); - return val; -} - // Used by the main thread to wakeup the cache thread, and to wait for the // cache thread. The cache mutex has to be locked when calling this function. // *retry_time should be set to 0 on the first call. @@ -232,7 +225,7 @@ static bool cache_fill(struct priv *s) } // number of buffer bytes which should be preserved in backwards direction - int64_t back = mp_clipi64(read - s->min_filepos, 0, s->back_size); + int64_t back = MPCLAMP(read - s->min_filepos, 0, s->back_size); // number of buffer bytes that are valid and can be read int64_t newb = FFMAX(s->max_filepos - read, 0); @@ -297,7 +290,7 @@ static int resize_cache(struct priv *s, int64_t size) { int64_t min_size = FILL_LIMIT * 4; int64_t max_size = ((size_t)-1) / 4; - int64_t buffer_size = MPMIN(MPMAX(size, min_size), max_size); + int64_t buffer_size = MPCLAMP(size, min_size, max_size); unsigned char *buffer = malloc(buffer_size); if (!buffer) { -- cgit v1.2.3