[Wine-patches] [eterhack] oleaut32: Keep buffer in a bucket for smaller buffers if accurate bucket is full. (eterbug #8330)

Dmitry Timoshkov dtimoshkov на etersoft.ru
Вт Сен 25 10:02:49 MSK 2012


---
 dlls/oleaut32/oleaut.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/dlls/oleaut32/oleaut.c b/dlls/oleaut32/oleaut.c
index 250a812..2874b1c 100644
--- a/dlls/oleaut32/oleaut.c
+++ b/dlls/oleaut32/oleaut.c
@@ -259,7 +259,17 @@ void WINAPI SysFreeString(BSTR str)
     if(cache_entry) {
         EnterCriticalSection(&cs_bstr_cache);
 
-        if(cache_entry->cnt < sizeof(cache_entry->buf)/sizeof(*cache_entry->buf)) {
+        if(cache_entry->cnt == sizeof(cache_entry->buf)/sizeof(*cache_entry->buf)) {
+            if(cache_entry > bstr_cache) {
+                cache_entry--;
+                if(cache_entry->cnt == sizeof(cache_entry->buf)/sizeof(*cache_entry->buf))
+                    cache_entry = NULL;
+            }else {
+                cache_entry = NULL;
+            }
+        }
+
+        if(cache_entry) {
             cache_entry->buf[(cache_entry->head+cache_entry->cnt)%((sizeof(cache_entry->buf)/sizeof(*cache_entry->buf)))] = bstr;
             cache_entry->cnt++;
 
-- 
1.7.12.1

-- 
Dmitry.


Подробная информация о списке рассылки Wine-patches