Henri Verbeet : dxgi: Use the global memory allocation helpers.

Alexandre Julliard julliard at winehq.org
Tue Feb 6 15:55:49 CST 2018


Module: wine
Branch: master
Commit: c1cf16189f6573a85743de8562a21b39958f7fc4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c1cf16189f6573a85743de8562a21b39958f7fc4

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Feb  6 03:22:19 2018 +0330

dxgi: Use the global memory allocation helpers.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxgi/adapter.c      |  4 ++--
 dlls/dxgi/device.c       | 10 +++++-----
 dlls/dxgi/dxgi_main.c    | 11 +++++------
 dlls/dxgi/dxgi_private.h |  1 +
 dlls/dxgi/factory.c      |  6 +++---
 dlls/dxgi/output.c       |  4 ++--
 dlls/dxgi/surface.c      |  2 +-
 dlls/dxgi/swapchain.c    |  2 +-
 8 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c
index 64a18e6..ed2375a 100644
--- a/dlls/dxgi/adapter.c
+++ b/dlls/dxgi/adapter.c
@@ -73,7 +73,7 @@ static ULONG STDMETHODCALLTYPE dxgi_adapter_Release(IWineDXGIAdapter *iface)
     {
         wined3d_private_store_cleanup(&adapter->private_store);
         IDXGIFactory4_Release(&adapter->factory->IDXGIFactory4_iface);
-        HeapFree(GetProcessHeap(), 0, adapter);
+        heap_free(adapter);
     }
 
     return refcount;
@@ -356,7 +356,7 @@ static void dxgi_adapter_init(struct dxgi_adapter *adapter, struct dxgi_factory
 
 HRESULT dxgi_adapter_create(struct dxgi_factory *factory, UINT ordinal, struct dxgi_adapter **adapter)
 {
-    if (!(*adapter = HeapAlloc(GetProcessHeap(), 0, sizeof(**adapter))))
+    if (!(*adapter = heap_alloc(sizeof(**adapter))))
         return E_OUTOFMEMORY;
 
     dxgi_adapter_init(*adapter, factory, ordinal);
diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c
index 6015bbe..b4f36dc 100644
--- a/dlls/dxgi/device.c
+++ b/dlls/dxgi/device.c
@@ -87,7 +87,7 @@ static ULONG STDMETHODCALLTYPE dxgi_device_Release(IWineDXGIDevice *iface)
         wined3d_mutex_unlock();
         IWineDXGIAdapter_Release(device->adapter);
         wined3d_private_store_cleanup(&device->private_store);
-        HeapFree(GetProcessHeap(), 0, device);
+        heap_free(device);
     }
 
     return refcount;
@@ -287,7 +287,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *ifa
     TRACE("iface %p, wined3d_texture %p, usage %#x, shared_resource %p, outer %p, surface %p.\n",
             iface, wined3d_texture, usage, shared_resource, outer, surface);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
     {
         ERR("Failed to allocate DXGI surface object memory\n");
         return E_OUTOFMEMORY;
@@ -296,7 +296,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *ifa
     if (FAILED(hr = dxgi_surface_init(object, (IDXGIDevice *)iface, outer, wined3d_texture)))
     {
         WARN("Failed to initialize surface, hr %#x.\n", hr);
-        HeapFree(GetProcessHeap(), 0, object);
+        heap_free(object);
         return hr;
     }
 
@@ -316,7 +316,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_swapchain(IWineDXGIDevice *i
     TRACE("iface %p, desc %p, wined3d_swapchain %p.\n",
             iface, desc, wined3d_swapchain);
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
     {
         ERR("Failed to allocate DXGI swapchain object memory\n");
         return E_OUTOFMEMORY;
@@ -325,7 +325,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_swapchain(IWineDXGIDevice *i
     if (FAILED(hr = dxgi_swapchain_init(object, device, desc, implicit)))
     {
         WARN("Failed to initialize swapchain, hr %#x.\n", hr);
-        HeapFree(GetProcessHeap(), 0, object);
+        heap_free(object);
         return hr;
     }
 
diff --git a/dlls/dxgi/dxgi_main.c b/dlls/dxgi/dxgi_main.c
index 36cf73b..df8761b 100644
--- a/dlls/dxgi/dxgi_main.c
+++ b/dlls/dxgi/dxgi_main.c
@@ -35,7 +35,7 @@ static struct dxgi_main dxgi_main;
 
 static void dxgi_main_cleanup(void)
 {
-    HeapFree(GetProcessHeap(), 0, dxgi_main.device_layers);
+    heap_free(dxgi_main.device_layers);
     FreeLibrary(dxgi_main.d3d10core);
 }
 
@@ -188,8 +188,7 @@ HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, I
     device_size = d3d10_layer.get_size(d3d10_layer.id, &get_size_args, 0);
     device_size += sizeof(*dxgi_device);
 
-    dxgi_device = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, device_size);
-    if (!dxgi_device)
+    if (!(dxgi_device = heap_alloc_zero(device_size)))
     {
         ERR("Failed to allocate device memory.\n");
         return E_OUTOFMEMORY;
@@ -199,7 +198,7 @@ HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, I
     if (FAILED(hr))
     {
         WARN("Failed to initialize device, hr %#x.\n", hr);
-        HeapFree(GetProcessHeap(), 0, dxgi_device);
+        heap_free(dxgi_device);
         *device = NULL;
         return hr;
     }
@@ -220,9 +219,9 @@ HRESULT WINAPI DXGID3D10RegisterLayers(const struct dxgi_device_layer *layers, U
     wined3d_mutex_lock();
 
     if (!dxgi_main.layer_count)
-        new_layers = HeapAlloc(GetProcessHeap(), 0, layer_count * sizeof(*new_layers));
+        new_layers = heap_alloc(layer_count * sizeof(*new_layers));
     else
-        new_layers = HeapReAlloc(GetProcessHeap(), 0, dxgi_main.device_layers,
+        new_layers = heap_realloc(dxgi_main.device_layers,
                 (dxgi_main.layer_count + layer_count) * sizeof(*new_layers));
 
     if (!new_layers)
diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h
index 19c880b..ed79ca2 100644
--- a/dlls/dxgi/dxgi_private.h
+++ b/dlls/dxgi/dxgi_private.h
@@ -20,6 +20,7 @@
 #define __WINE_DXGI_PRIVATE_H
 
 #include "wine/debug.h"
+#include "wine/heap.h"
 
 #include <assert.h>
 
diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c
index 832e2cb..50b7941 100644
--- a/dlls/dxgi/factory.c
+++ b/dlls/dxgi/factory.c
@@ -81,7 +81,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IDXGIFactory4 *iface)
         wined3d_decref(factory->wined3d);
         wined3d_mutex_unlock();
         wined3d_private_store_cleanup(&factory->private_store);
-        HeapFree(GetProcessHeap(), 0, factory);
+        heap_free(factory);
     }
 
     return refcount;
@@ -547,13 +547,13 @@ HRESULT dxgi_factory_create(REFIID riid, void **factory, BOOL extended)
     struct dxgi_factory *object;
     HRESULT hr;
 
-    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+    if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
     if (FAILED(hr = dxgi_factory_init(object, extended)))
     {
         WARN("Failed to initialize factory, hr %#x.\n", hr);
-        HeapFree(GetProcessHeap(), 0, object);
+        heap_free(object);
         return hr;
     }
 
diff --git a/dlls/dxgi/output.c b/dlls/dxgi/output.c
index 9659c85..2b168fb 100644
--- a/dlls/dxgi/output.c
+++ b/dlls/dxgi/output.c
@@ -81,7 +81,7 @@ static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput4 *iface)
     {
         wined3d_private_store_cleanup(&output->private_store);
         IWineDXGIAdapter_Release(&output->adapter->IWineDXGIAdapter_iface);
-        HeapFree(GetProcessHeap(), 0, output);
+        heap_free(output);
     }
 
     return refcount;
@@ -447,7 +447,7 @@ static void dxgi_output_init(struct dxgi_output *output, struct dxgi_adapter *ad
 
 HRESULT dxgi_output_create(struct dxgi_adapter *adapter, struct dxgi_output **output)
 {
-    if (!(*output = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**output))))
+    if (!(*output = heap_alloc_zero(sizeof(**output))))
         return E_OUTOFMEMORY;
 
     dxgi_output_init(*output, adapter);
diff --git a/dlls/dxgi/surface.c b/dlls/dxgi/surface.c
index 36fc1e6..ad72a2c 100644
--- a/dlls/dxgi/surface.c
+++ b/dlls/dxgi/surface.c
@@ -74,7 +74,7 @@ static ULONG STDMETHODCALLTYPE dxgi_surface_inner_Release(IUnknown *iface)
     if (!refcount)
     {
         wined3d_private_store_cleanup(&surface->private_store);
-        HeapFree(GetProcessHeap(), 0, surface);
+        heap_free(surface);
     }
 
     return refcount;
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index e5d06c3..1f88d71 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -645,7 +645,7 @@ static void STDMETHODCALLTYPE dxgi_swapchain_wined3d_object_released(void *paren
     struct dxgi_swapchain *swapchain = parent;
 
     wined3d_private_store_cleanup(&swapchain->private_store);
-    HeapFree(GetProcessHeap(), 0, parent);
+    heap_free(parent);
 }
 
 static const struct wined3d_parent_ops dxgi_swapchain_wined3d_parent_ops =




More information about the wine-cvs mailing list