dxgi: Use the global memory allocation helpers.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-02-06 03:04:19 +03:30 committed by Alexandre Julliard
parent 86baab093c
commit c1cf16189f
8 changed files with 20 additions and 20 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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)

View file

@ -20,6 +20,7 @@
#define __WINE_DXGI_PRIVATE_H
#include "wine/debug.h"
#include "wine/heap.h"
#include <assert.h>

View file

@ -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;
}

View file

@ -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);

View file

@ -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;

View file

@ -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 =