Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/eet

Dir     : e17/libs/eet/src/lib


Modified Files:
        eet_lib.c 


Log Message:


avoid fd overflow.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/eet/src/lib/eet_lib.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- eet_lib.c   4 Nov 2005 18:29:02 -0000       1.52
+++ eet_lib.c   7 Nov 2005 03:15:22 -0000       1.53
@@ -117,6 +117,28 @@
    Eet_File **new_cache;
    int new_cache_num, new_cache_alloc;
 
+   new_cache_num = *cache_num;
+   if (new_cache_num > 128) /* avoid fd overruns - limit to 128 (most recent) 
in the cache */
+     {
+       Eet_File *del_ef = NULL;
+       int i;
+       
+       new_cache = *cache;
+       for (i = 0; i < new_cache_num; i++)
+         {
+            if (new_cache[i]->references == 0)
+              {
+                 del_ef = new_cache[i];
+                 break;
+              }
+         }
+       if (del_ef)
+         {
+            eet_cacheburst_mode = 0;
+            eet_cache_del(del_ef, cache, cache_num, cache_alloc);
+            eet_cacheburst_mode = 1;
+         }
+     }
    new_cache = *cache;
    new_cache_num = *cache_num;
    new_cache_alloc = *cache_alloc;




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to