Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/lib/cache Modified Files: evas_cache_image.c Log Message: and actively remove images when they are KNOWN to have been removed from disk or the cached copies have 0 refs and are too old (thus wasting cache space). =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/cache/evas_cache_image.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- evas_cache_image.c 11 Aug 2007 12:14:17 -0000 1.5 +++ evas_cache_image.c 11 Aug 2007 12:22:43 -0000 1.6 @@ -151,8 +151,24 @@ hkey = alloca(sizeof (char) * size); snprintf(hkey, size, format, file, key, lo->scale_down_by, lo->dpi, lo->w, lo->h); - if (stat(file, &st) < 0) return NULL; - /* FIXME: Handle timestamp correctly. */ + if (stat(file, &st) < 0) + { + im = evas_hash_find(cache->inactiv, hkey); + if (im) + { + cache->lru = evas_object_list_remove(cache->lru, im); + cache->inactiv = evas_hash_del(cache->inactiv, im->cache_key, im); + cache->usage -= cache->func.mem_size_get(im); + if (im->cache_key) + { + evas_stringshare_del(im->cache_key); + im->cache_key = NULL; + } + cache->func.destructor(im); + evas_common_image_delete(im); + } + return NULL; + } im = evas_hash_find(cache->activ, hkey); if (im) @@ -171,6 +187,19 @@ cache->activ = evas_hash_direct_add(cache->activ, im->cache_key, im); cache->usage -= cache->func.mem_size_get(im); goto on_ok; + } + else + { + cache->lru = evas_object_list_remove(cache->lru, im); + cache->inactiv = evas_hash_del(cache->inactiv, im->cache_key, im); + cache->usage -= cache->func.mem_size_get(im); + if (im->cache_key) + { + evas_stringshare_del(im->cache_key); + im->cache_key = NULL; + } + cache->func.destructor(im); + evas_common_image_delete(im); } } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs