Paul Gofman : d3dx9: Simplify init and cleanup in get_constants_desc().

Alexandre Julliard julliard at winehq.org
Mon Jul 10 15:52:47 CDT 2017


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

Author: Paul Gofman <gofmanp at gmail.com>
Date:   Thu Jul  6 14:15:07 2017 +0300

d3dx9: Simplify init and cleanup in get_constants_desc().

Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx9_36/preshader.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c
index 2fb14ab..cabddcd 100644
--- a/dlls/d3dx9_36/preshader.c
+++ b/dlls/d3dx9_36/preshader.c
@@ -618,10 +618,6 @@ static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab
     D3DXHANDLE hc;
     unsigned int i;
 
-    out->inputs = cdesc = NULL;
-    out->inputs_param = NULL;
-    out->input_count = 0;
-    inputs_param = NULL;
     hr = D3DXGetShaderConstantTable(byte_code, &ctab);
     if (FAILED(hr) || !ctab)
     {
@@ -635,8 +631,8 @@ static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab
         goto err_out;
     }
 
-    cdesc = HeapAlloc(GetProcessHeap(), 0, sizeof(*cdesc) * desc.Constants);
-    inputs_param = HeapAlloc(GetProcessHeap(), 0, sizeof(*inputs_param) * desc.Constants);
+    out->inputs = cdesc = HeapAlloc(GetProcessHeap(), 0, sizeof(*cdesc) * desc.Constants);
+    out->inputs_param = inputs_param = HeapAlloc(GetProcessHeap(), 0, sizeof(*inputs_param) * desc.Constants);
     if (!cdesc || !inputs_param)
     {
         hr = E_OUTOFMEMORY;
@@ -678,16 +674,9 @@ static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab
         }
     }
     out->input_count = desc.Constants;
-    out->inputs = cdesc;
-    out->inputs_param = inputs_param;
     hr = init_set_constants(out, ctab);
-    ID3DXConstantTable_Release(ctab);
-    return hr;
 err_out:
-    HeapFree(GetProcessHeap(), 0, cdesc);
-    HeapFree(GetProcessHeap(), 0, inputs_param);
-    if (ctab)
-        ID3DXConstantTable_Release(ctab);
+    ID3DXConstantTable_Release(ctab);
     return hr;
 }
 




More information about the wine-cvs mailing list