From 3836bfb1ad6a08e96e1ce88428c932f0b7766950 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 9 Apr 2014 22:34:58 +0200 Subject: cache: fix checks/output on initialization resize_cache() checks the size itself and clamps the size to the valid range if necessary, so we don't need these checks. In fact, the checks are different. Also, output the cache size after clamping, instead of before. --- stream/cache.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/stream/cache.c b/stream/cache.c index 27c9a30b22..64c993975e 100644 --- a/stream/cache.c +++ b/stream/cache.c @@ -659,14 +659,6 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size, if (size < 1) return -1; - MP_INFO(cache, "Cache size set to %" PRId64 " KiB\n", - size / 1024); - - if (size > SIZE_MAX) { - MP_FATAL(cache, "Cache size larger than max. allocation size\n"); - return -1; - } - struct priv *s = talloc_zero(NULL, struct priv); s->log = cache->log; @@ -678,6 +670,9 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size, return -1; } + MP_INFO(cache, "Cache size set to %" PRId64 " KiB\n", + s->buffer_size / 1024); + pthread_mutex_init(&s->mutex, NULL); pthread_cond_init(&s->wakeup, NULL); -- cgit v1.2.3