]> granicus.if.org Git - libass/commitdiff
cache: safer ass_cache_stats
authorGrigori Goronzy <greg@blackbox>
Mon, 27 Jun 2011 17:52:53 +0000 (19:52 +0200)
committerGrigori Goronzy <greg@blackbox>
Mon, 27 Jun 2011 17:52:53 +0000 (19:52 +0200)
libass/ass_cache.c

index 8d42e615865470144d14126153686798824bd817..6c345397862c6ac46477f7390de014d71f9dc573 100644 (file)
@@ -276,10 +276,14 @@ int ass_cache_empty(Cache *cache, size_t max_size)
 void ass_cache_stats(Cache *cache, size_t *size, unsigned *hits,
                      unsigned *misses, unsigned *count)
 {
-    *size = cache->cache_size;
-    *hits = cache->hits;
-    *misses = cache->misses;
-    *count = cache->items;
+    if (size)
+        *size = cache->cache_size;
+    if (hits)
+        *hits = cache->hits;
+    if (misses)
+        *misses = cache->misses;
+    if (count)
+        *count = cache->items;
 }
 
 void ass_cache_done(Cache *cache)