Huw Davies : ole32: Add the ability to create an entry without returning it.

Alexandre Julliard julliard at winehq.org
Tue Jun 6 15:23:31 CDT 2017


Module: wine
Branch: master
Commit: 111b72fc85b19820a71accc037e6904638c4380a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=111b72fc85b19820a71accc037e6904638c4380a

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Jun  6 11:46:50 2017 +0100

ole32: Add the ability to create an entry without returning it.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ole32/datacache.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index c9ab200..d97e288 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -363,6 +363,7 @@ static HRESULT DataCache_CreateEntry(DataCache *This, const FORMATETC *formatetc
                                      DataCacheEntry **cache_entry)
 {
     HRESULT hr;
+    DataCacheEntry *entry;
 
     hr = check_valid_clipformat_and_tymed(formatetc->cfFormat, formatetc->tymed);
     if (FAILED(hr))
@@ -370,20 +371,21 @@ static HRESULT DataCache_CreateEntry(DataCache *This, const FORMATETC *formatetc
     if (hr == CACHE_S_FORMATETC_NOTSUPPORTED)
         TRACE("creating unsupported format %d\n", formatetc->cfFormat);
 
-    *cache_entry = HeapAlloc(GetProcessHeap(), 0, sizeof(**cache_entry));
-    if (!*cache_entry)
+    entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
+    if (!entry)
         return E_OUTOFMEMORY;
 
-    if (!init_cache_entry(*cache_entry, formatetc, advf, This->last_cache_id))
+    if (!init_cache_entry(entry, formatetc, advf, This->last_cache_id))
         goto fail;
 
-    list_add_tail(&This->cache_list, &(*cache_entry)->entry);
+    list_add_tail(&This->cache_list, &entry->entry);
     This->last_cache_id++;
 
+    if (cache_entry) *cache_entry = entry;
     return hr;
 
 fail:
-    HeapFree(GetProcessHeap(), 0, *cache_entry);
+    HeapFree(GetProcessHeap(), 0, entry);
     return E_OUTOFMEMORY;
 }
 




More information about the wine-cvs mailing list