wined3d: Remove ERR() on HeapAlloc failure for small sizes known at compile time

Michael Stefaniuc mstefani at redhat.de
Tue Feb 5 08:49:14 CST 2013


---
 dlls/wined3d/ati_fragment_shader.c |    4 +---
 dlls/wined3d/buffer.c              |    5 -----
 dlls/wined3d/context.c             |    3 ---
 dlls/wined3d/device.c              |    4 +---
 dlls/wined3d/directx.c             |    3 ---
 dlls/wined3d/glsl_shader.c         |    3 ---
 dlls/wined3d/palette.c             |    3 ---
 dlls/wined3d/query.c               |    3 ---
 dlls/wined3d/sampler.c             |    3 ---
 dlls/wined3d/shader.c              |   12 ------------
 dlls/wined3d/shader_sm1.c          |    3 ---
 dlls/wined3d/stateblock.c          |    3 ---
 dlls/wined3d/surface.c             |    3 ---
 dlls/wined3d/swapchain.c           |    3 ---
 dlls/wined3d/texture.c             |    3 ---
 dlls/wined3d/vertexdeclaration.c   |    3 ---
 dlls/wined3d/view.c                |    3 ---
 dlls/wined3d/volume.c              |    1 -
 18 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c
index 5657732..34330c2 100644
--- a/dlls/wined3d/ati_fragment_shader.c
+++ b/dlls/wined3d/ati_fragment_shader.c
@@ -1153,10 +1153,8 @@ static void *atifs_alloc(const struct wined3d_shader_backend_ops *shader_backend
     struct atifs_private_data *priv;
 
     if (!(priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv))))
-    {
-        ERR("Out of memory.\n");
         return NULL;
-    }
+
     if (wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1)
     {
         ERR("Failed to initialize rbtree.\n");
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 415b5e5..e9a07a5 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1283,10 +1283,7 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, struct wined3
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate memory\n");
         return E_OUTOFMEMORY;
-    }
 
     FIXME("Ignoring access flags (pool)\n");
 
@@ -1328,7 +1325,6 @@ HRESULT CDECL wined3d_buffer_create_vb(struct wined3d_device *device, UINT size,
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
     {
-        ERR("Out of memory\n");
         *buffer = NULL;
         return WINED3DERR_OUTOFVIDEOMEMORY;
     }
@@ -1360,7 +1356,6 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size,
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
     {
-        ERR("Out of memory\n");
         *buffer = NULL;
         return WINED3DERR_OUTOFVIDEOMEMORY;
     }
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 85e4780..cf65225 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1277,10 +1277,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
 
     ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret));
     if (!ret)
-    {
-        ERR("Failed to allocate context memory.\n");
         return NULL;
-    }
 
     ret->blit_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
             gl_info->limits.buffers * sizeof(*ret->blit_targets));
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 26c0832..bbd27df 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1765,10 +1765,8 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
         TRACE("Adding new light\n");
         object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
         if (!object)
-        {
-            ERR("Out of memory error when allocating a light\n");
             return E_OUTOFMEMORY;
-        }
+
         list_add_head(&device->updateStateBlock->state.light_map[hash_idx], &object->entry);
         object->glIndex = -1;
         object->OriginalIndex = light_idx;
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index d9e2607..7734cba 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -4780,10 +4780,7 @@ HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, e
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate device memory.\n");
         return E_OUTOFMEMORY;
-    }
 
     hr = device_init(object, wined3d, adapter_idx, device_type,
             focus_window, flags, surface_alignment, device_parent);
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 16b8a83..7d98487 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -5446,10 +5446,7 @@ static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(str
         return CONTAINING_RECORD(desc, struct glsl_ffp_fragment_shader, entry);
 
     if (!(glsl_desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*glsl_desc))))
-    {
-        ERR("Failed to allocate ffp desc memory.\n");
         return NULL;
-    }
 
     glsl_desc->entry.settings = *args;
     glsl_desc->id = shader_glsl_generate_ffp_fragment_shader(&priv->shader_buffer, args, gl_info);
diff --git a/dlls/wined3d/palette.c b/dlls/wined3d/palette.c
index 1e85be2..417b3ac 100644
--- a/dlls/wined3d/palette.c
+++ b/dlls/wined3d/palette.c
@@ -199,10 +199,7 @@ HRESULT CDECL wined3d_palette_create(struct wined3d_device *device, DWORD flags,
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate palette memory.\n");
         return E_OUTOFMEMORY;
-    }
 
     hr = wined3d_palette_init(object, device, flags, entries, parent);
     if (FAILED(hr))
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index d3c3923..a3a9246 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -610,10 +610,7 @@ HRESULT CDECL wined3d_query_create(struct wined3d_device *device,
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate query memory.\n");
         return E_OUTOFMEMORY;
-    }
 
     hr = query_init(object, device, type);
     if (FAILED(hr))
diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c
index 1156d2a..d5c44c9 100644
--- a/dlls/wined3d/sampler.c
+++ b/dlls/wined3d/sampler.c
@@ -65,10 +65,7 @@ HRESULT CDECL wined3d_sampler_create(void *parent, struct wined3d_sampler **samp
     TRACE("parent %p, sampler %p.\n", parent, sampler);
 
     if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
-    {
-        ERR("Failed to allocate memory.\n");
         return E_OUTOFMEMORY;
-    }
 
     wined3d_sampler_init(object, parent);
 
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 44f67cc..2c65e71 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1510,10 +1510,7 @@ static HRESULT shader_none_alloc(struct wined3d_device *device, const struct fra
     void *fragment_priv;
 
     if (!(priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv))))
-    {
-        ERR("Failed to allocate private data.\n");
         return E_OUTOFMEMORY;
-    }
 
     if (!(fragment_priv = fragment_pipe->alloc_private(&none_shader_backend, priv)))
     {
@@ -2303,10 +2300,7 @@ HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const DWOR
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate shader memory.\n");
         return E_OUTOFMEMORY;
-    }
 
     hr = geometryshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version);
     if (FAILED(hr))
@@ -2334,10 +2328,7 @@ HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const DWOR
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate shader memory.\n");
         return E_OUTOFMEMORY;
-    }
 
     hr = pixelshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version);
     if (FAILED(hr))
@@ -2365,10 +2356,7 @@ HRESULT CDECL wined3d_shader_create_vs(struct wined3d_device *device, const DWOR
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate shader memory.\n");
         return E_OUTOFMEMORY;
-    }
 
     hr = vertexshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version);
     if (FAILED(hr))
diff --git a/dlls/wined3d/shader_sm1.c b/dlls/wined3d/shader_sm1.c
index 6ad1777..34e0f8c 100644
--- a/dlls/wined3d/shader_sm1.c
+++ b/dlls/wined3d/shader_sm1.c
@@ -530,10 +530,7 @@ static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader
 
     priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv));
     if (!priv)
-    {
-        ERR("Failed to allocate private data\n");
         return NULL;
-    }
 
     if (output_signature)
     {
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 6f55dc3..8e17d23 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1451,10 +1451,7 @@ HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device,
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate stateblock memory.\n");
         return E_OUTOFMEMORY;
-    }
 
     hr = stateblock_init(object, device, type);
     if (FAILED(hr))
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index fdda681..57527e4 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -7247,10 +7247,7 @@ HRESULT CDECL wined3d_surface_create(struct wined3d_device *device, UINT width,
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate surface memory.\n");
         return WINED3DERR_OUTOFVIDEOMEMORY;
-    }
 
     if (FAILED(hr = surface_init(object, device->surface_alignment, width, height, multisample_type,
             multisample_quality, device, usage, format_id, pool, flags, parent, parent_ops)))
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index cf1914a..c4f17ae 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1098,10 +1098,7 @@ HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device, struct win
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate swapchain memory.\n");
         return E_OUTOFMEMORY;
-    }
 
     hr = swapchain_init(object, device, desc, parent, parent_ops);
     if (FAILED(hr))
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 498bbb6..9bf4c2e 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1251,7 +1251,6 @@ HRESULT CDECL wined3d_texture_create_2d(struct wined3d_device *device, UINT widt
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
     {
-        ERR("Out of memory.\n");
         *texture = NULL;
         return WINED3DERR_OUTOFVIDEOMEMORY;
     }
@@ -1287,7 +1286,6 @@ HRESULT CDECL wined3d_texture_create_3d(struct wined3d_device *device, UINT widt
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
     {
-        ERR("Out of memory\n");
         *texture = NULL;
         return WINED3DERR_OUTOFVIDEOMEMORY;
     }
@@ -1323,7 +1321,6 @@ HRESULT CDECL wined3d_texture_create_cube(struct wined3d_device *device, UINT ed
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
     {
-        ERR("Out of memory\n");
         *texture = NULL;
         return WINED3DERR_OUTOFVIDEOMEMORY;
     }
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index ff8c07c..13f4490 100644
--- a/dlls/wined3d/vertexdeclaration.c
+++ b/dlls/wined3d/vertexdeclaration.c
@@ -252,10 +252,7 @@ HRESULT CDECL wined3d_vertex_declaration_create(struct wined3d_device *device,
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if(!object)
-    {
-        ERR("Failed to allocate vertex declaration memory.\n");
         return E_OUTOFMEMORY;
-    }
 
     hr = vertexdeclaration_init(object, device, elements, element_count, parent, parent_ops);
     if (FAILED(hr))
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 872335f..54ed9e4 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -77,10 +77,7 @@ HRESULT CDECL wined3d_rendertarget_view_create(struct wined3d_resource *resource
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
-    {
-        ERR("Failed to allocate memory\n");
         return E_OUTOFMEMORY;
-    }
 
     wined3d_rendertarget_view_init(object, resource, parent);
 
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index ed68671..a9cbafe 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -312,7 +312,6 @@ HRESULT CDECL wined3d_volume_create(struct wined3d_device *device, UINT width, U
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
     {
-        ERR("Out of memory\n");
         *volume = NULL;
         return WINED3DERR_OUTOFVIDEOMEMORY;
     }
-- 
1.7.7.6



More information about the wine-patches mailing list