janitorial: Remove redundant NULL checks before SHFree (2/2)
James Hawkins
truiken at gmail.com
Fri Oct 6 20:07:16 CDT 2006
Hi,
Changelog:
* Remove redundant NULL checks before SHFree (2/2).
dlls/shell32/shfldr_fs.c | 16 +++++-----------
dlls/shell32/shfldr_mycomp.c | 3 +--
dlls/shell32/shlexec.c | 14 +++++++-------
dlls/shell32/shlmenu.c | 11 +++--------
dlls/shell32/shlview.c | 8 ++------
dlls/shell32/shv_item_cmenu.c | 3 +--
dlls/shell32/trash.c | 3 +--
7 files changed, 20 insertions(+), 38 deletions(-)
--
James Hawkins
-------------- next part --------------
diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c
index 8bd6eaf..3c05e71 100644
--- a/dlls/shell32/shfldr_fs.c
+++ b/dlls/shell32/shfldr_fs.c
@@ -194,10 +194,8 @@ static ULONG WINAPI IUnknown_fnRelease (
if (!refCount) {
TRACE ("-- destroying IShellFolder(%p)\n", This);
- if (This->pidlRoot)
- SHFree (This->pidlRoot);
- if (This->sPathTarget)
- SHFree (This->sPathTarget);
+ SHFree (This->pidlRoot);
+ SHFree (This->sPathTarget);
LocalFree ((HLOCAL) This);
}
return refCount;
@@ -1380,15 +1378,11 @@ IFSFldr_PersistFolder3_Initialize (IPers
TRACE ("(%p)->(%p)\n", This, pidl);
- if (This->pidlRoot)
- SHFree (This->pidlRoot); /* free the old pidl */
+ SHFree (This->pidlRoot); /* free the old pidl */
This->pidlRoot = ILClone (pidl); /* set my pidl */
- if (This->sPathTarget)
- {
- SHFree (This->sPathTarget);
- This->sPathTarget = NULL;
- }
+ SHFree (This->sPathTarget);
+ This->sPathTarget = NULL;
/* set my path */
if (SHGetPathFromIDListW (pidl, wszTemp)) {
diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c
index c9a5c07..c842c7e 100644
--- a/dlls/shell32/shfldr_mycomp.c
+++ b/dlls/shell32/shfldr_mycomp.c
@@ -186,8 +186,7 @@ static ULONG WINAPI ISF_MyComputer_fnRel
if (!refCount)
{
TRACE ("-- destroying IShellFolder(%p)\n", This);
- if (This->pidlRoot)
- SHFree (This->pidlRoot);
+ SHFree (This->pidlRoot);
LocalFree ((HLOCAL) This);
}
return refCount;
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index 6ca0b19..f5704c3 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -882,8 +882,8 @@ HINSTANCE WINAPI FindExecutableA(LPCSTR
retval = FindExecutableW(wFile, wDirectory, wResult);
WideCharToMultiByte(CP_ACP, 0, wResult, -1, lpResult, MAX_PATH, NULL, NULL);
- if (wFile) SHFree( wFile );
- if (wDirectory) SHFree( wDirectory );
+ SHFree( wFile );
+ SHFree( wDirectory );
TRACE("returning %s\n", lpResult);
return retval;
@@ -1580,11 +1580,11 @@ BOOL WINAPI ShellExecuteExA (LPSHELLEXEC
if (sei->fMask & SEE_MASK_NOCLOSEPROCESS)
sei->hProcess = seiW.hProcess;
- if (wVerb) SHFree(wVerb);
- if (wFile) SHFree(wFile);
- if (wParameters) SHFree(wParameters);
- if (wDirectory) SHFree(wDirectory);
- if (wClass) SHFree(wClass);
+ SHFree(wVerb);
+ SHFree(wFile);
+ SHFree(wParameters);
+ SHFree(wDirectory);
+ SHFree(wClass);
return ret;
}
diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c
index 42cec7a..065e3c1 100644
--- a/dlls/shell32/shlmenu.c
+++ b/dlls/shell32/shlmenu.c
@@ -115,9 +115,7 @@ static LPFMINFO FM_SetMenuParameter(
menudata = FM_GetMenuInfo(hmenu);
- if ( menudata->pidl)
- { SHFree(menudata->pidl);
- }
+ SHFree(menudata->pidl);
menudata->uID = uID;
menudata->pidl = ILClone(pidl);
@@ -299,9 +297,7 @@ void WINAPI FileMenu_Destroy (HMENU hmen
menudata = FM_GetMenuInfo(hmenu);
- if ( menudata->pidl)
- { SHFree( menudata->pidl);
- }
+ SHFree( menudata->pidl);
HeapFree(GetProcessHeap(), 0, menudata);
DestroyMenu (hmenu);
@@ -692,8 +688,7 @@ BOOL WINAPI FileMenu_DeleteAllItems (HME
for (i = 0; i < GetMenuItemCount( hmenu ); i++)
{ GetMenuItemInfoW(hmenu, i, TRUE, &mii );
- if (mii.dwItemData)
- SHFree((LPFMINFO)mii.dwItemData);
+ SHFree((LPFMINFO)mii.dwItemData);
if (mii.hSubMenu)
FileMenu_Destroy(mii.hSubMenu);
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index d605fca..914071b 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -811,10 +811,7 @@ static UINT ShellView_GetSelections(IShe
LVITEMA lvItem;
UINT i = 0;
- if (This->apidl)
- {
- SHFree(This->apidl);
- }
+ SHFree(This->apidl);
This->cidl = ListView_GetSelectedCount(This->hWndList);
This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST));
@@ -1713,8 +1710,7 @@ static ULONG WINAPI IShellView_fnRelease
if(This->pSF2Parent)
IShellFolder2_Release(This->pSF2Parent);
- if(This->apidl)
- SHFree(This->apidl);
+ SHFree(This->apidl);
if(This->pAdvSink)
IAdviseSink_Release(This->pAdvSink);
diff --git a/dlls/shell32/shv_item_cmenu.c b/dlls/shell32/shv_item_cmenu.c
index 7d3d08c..ca2d593 100644
--- a/dlls/shell32/shv_item_cmenu.c
+++ b/dlls/shell32/shv_item_cmenu.c
@@ -166,8 +166,7 @@ static ULONG WINAPI ISvItemCm_fnRelease(
if(This->pSFParent)
IShellFolder_Release(This->pSFParent);
- if(This->pidl)
- SHFree(This->pidl);
+ SHFree(This->pidl);
/*make sure the pidl is freed*/
_ILFreeaPidl(This->apidl, This->cidl);
diff --git a/dlls/shell32/trash.c b/dlls/shell32/trash.c
index fc0ce42..4fe43e5 100644
--- a/dlls/shell32/trash.c
+++ b/dlls/shell32/trash.c
@@ -377,8 +377,7 @@ HRESULT TRASH_UnpackItemID(LPCSHITEMID i
void TRASH_DisposeElement(TRASH_ELEMENT *element)
{
- if (element)
- SHFree(element->filename);
+ SHFree(element->filename);
}
HRESULT TRASH_GetDetails(const TRASH_ELEMENT *element, WIN32_FIND_DATAW *data)
--
1.4.2.1
More information about the wine-patches
mailing list