comdlg32: Remove redundant NULL checks before MemFree. It's only a
wrapper around HeapFree. Found by Smatch.
Michael Stefaniuc
mstefani at redhat.de
Tue Aug 8 18:17:00 CDT 2006
Hello!
I expected those wrappers around HeapAlloc/HeapFree to be #defines and
not (inline) functions but there are quite a few of those spread through
Wine. We can remove the redundant NULL checks for those too.
bye
michael
---
dlls/comdlg32/filedlg.c | 37 ++++++++++++-------------------------
1 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index 6a780f1..8cd9c60 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -430,19 +430,12 @@ BOOL WINAPI GetFileDialog95A(LPOPENFILE
MemFree(lpstrSavDir);
}
- if(title)
- MemFree(title);
- if(defext)
- MemFree(defext);
- if(filter)
- MemFree(filter);
- if(customfilter)
- MemFree(customfilter);
- if(fodInfos.initdir)
- MemFree(fodInfos.initdir);
-
- if(fodInfos.filename)
- MemFree(fodInfos.filename);
+ MemFree(title);
+ MemFree(defext);
+ MemFree(filter);
+ MemFree(customfilter);
+ MemFree(fodInfos.initdir);
+ MemFree(fodInfos.filename);
TRACE("selected file: %s\n",ofn->lpstrFile);
@@ -1304,8 +1297,7 @@ static LRESULT FILEDLG95_InitControls(HW
result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit);
if (result) {
*nameBit = 0x00;
- if (fodInfos->initdir)
- MemFree(fodInfos->initdir);
+ MemFree(fodInfos->initdir);
fodInfos->initdir = MemAlloc((strlenW(tmpBuf2) + 1)*sizeof(WCHAR));
strcpyW(fodInfos->initdir, tmpBuf2);
handledPath = TRUE;
@@ -1342,8 +1334,7 @@ static LRESULT FILEDLG95_InitControls(HW
*nameBit = 0x00;
len = strlenW(tmpBuf);
- if(fodInfos->initdir)
- MemFree(fodInfos->initdir);
+ MemFree(fodInfos->initdir);
fodInfos->initdir = MemAlloc((len+1)*sizeof(WCHAR));
strcpyW(fodInfos->initdir, tmpBuf);
@@ -1384,8 +1375,7 @@ static LRESULT FILEDLG95_InitControls(HW
} else {
searchMore = FALSE;
- if(fodInfos->initdir)
- MemFree(fodInfos->initdir);
+ MemFree(fodInfos->initdir);
fodInfos->initdir = MemAlloc(MAX_PATH*sizeof(WCHAR));
GetCurrentDirectoryW(MAX_PATH, fodInfos->initdir);
@@ -2000,8 +1990,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
DWORD len;
/* replace the current filter */
- if(fodInfos->ShellInfos.lpstrCurrentFilter)
- MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter);
+ MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter);
len = strlenW(lpszTemp)+1;
fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc(len * sizeof(WCHAR));
strcpyW( fodInfos->ShellInfos.lpstrCurrentFilter, lpszTemp);
@@ -2472,8 +2461,7 @@ static BOOL FILEDLG95_FILETYPE_OnCommand
(fodInfos->customfilter == NULL ? 1 : 0);
/* Set the current filter with the current selection */
- if(fodInfos->ShellInfos.lpstrCurrentFilter)
- MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter);
+ MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter);
lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
iItem);
@@ -2538,8 +2526,7 @@ static void FILEDLG95_FILETYPE_Clean(HWN
}
}
/* Current filter */
- if(fodInfos->ShellInfos.lpstrCurrentFilter)
- MemFree(fodInfos->ShellInfos.lpstrCurrentFilter);
+ MemFree(fodInfos->ShellInfos.lpstrCurrentFilter);
}
--
1.4.1
--
Michael Stefaniuc Tel.: +49-711-96437-199
Sr. Network Engineer Fax.: +49-711-96437-111
Red Hat GmbH Email: mstefani at redhat.com
Hauptstaetterstr. 58 http://www.redhat.de/
D-70178 Stuttgart
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060809/6d452b99/attachment.pgp
More information about the wine-patches
mailing list