dlls/msi/helpers.c -- remove two useless checks (and dead code)

Gerald Pfeifer gerald at pfeifer.com
Sat Nov 3 13:03:20 CDT 2007


In both those code paths size is an unsigned type, so the check for 
non-negativity does not make any sense.  In the second case this leads
to the removal of some dead code after the (now unconditional) return
statement.

Gerald

ChangeLogs:
Remove two useless checks (and a bit of dead code).

Index: dlls/msi/helpers.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/helpers.c,v
retrieving revision 1.71
diff -u -3 -p -r1.71 helpers.c
--- dlls/msi/helpers.c	1 Nov 2007 12:41:11 -0000	1.71
+++ dlls/msi/helpers.c	3 Nov 2007 18:01:09 -0000
@@ -368,17 +368,16 @@ DWORD deformat_string(MSIPACKAGE *packag
 
         MSI_RecordSetStringW(rec,0,ptr);
         MSI_FormatRecordW(package,rec,NULL,&size);
-        if (size >= 0)
-        {
-            size++;
-            *data = msi_alloc(size*sizeof(WCHAR));
-            if (size > 1)
-                MSI_FormatRecordW(package,rec,*data,&size);
-            else
-                *data[0] = 0;
-            msiobj_release( &rec->hdr );
-            return sizeof(WCHAR)*size;
-        }
+
+        size++;
+        *data = msi_alloc(size*sizeof(WCHAR));
+        if (size > 1)
+            MSI_FormatRecordW(package,rec,*data,&size);
+        else
+            *data[0] = 0;
+        msiobj_release( &rec->hdr );
+        return sizeof(WCHAR)*size;
+
         msiobj_release( &rec->hdr );
     }
 
@@ -1031,20 +1030,14 @@ WCHAR* generate_error_string(MSIPACKAGE 
     va_end(va);
 
     MSI_FormatRecordW(package,rec,NULL,&size);
-    if (size >= 0)
-    {
-        size++;
-        data = msi_alloc(size*sizeof(WCHAR));
-        if (size > 1)
-            MSI_FormatRecordW(package,rec,data,&size);
-        else
-            data[0] = 0;
-        msiobj_release( &rec->hdr );
-        return data;
-    }
 
+    size++;
+    data = msi_alloc(size*sizeof(WCHAR));
+    if (size > 1)
+        MSI_FormatRecordW(package,rec,data,&size);
+    else
+        data[0] = 0;
     msiobj_release( &rec->hdr );
-    data = NULL;
     return data;
 }
 



More information about the wine-patches mailing list