Module: wine Branch: master Commit: 22ecd7aa6769c411ffdf4e784bd31b508d279d06 URL: http://source.winehq.org/git/wine.git/?a=commit;h=22ecd7aa6769c411ffdf4e784b...
Author: Michael Stefaniuc mstefani@redhat.de Date: Wed Mar 7 21:55:31 2007 +0100
comctl32: Remove redundant NULL checks before Free() (found by Smatch).
---
dlls/comctl32/comboex.c | 6 ++---- dlls/comctl32/comctl32undoc.c | 12 ++++-------- dlls/comctl32/header.c | 4 ++-- dlls/comctl32/propsheet.c | 4 ++-- dlls/comctl32/rebar.c | 6 ++---- dlls/comctl32/status.c | 21 +++++++++------------ dlls/comctl32/string.c | 12 ++++-------- dlls/comctl32/syslink.c | 13 +++++-------- dlls/comctl32/tab.c | 7 ++----- dlls/comctl32/toolbar.c | 3 +-- dlls/comctl32/updown.c | 2 +- 11 files changed, 34 insertions(+), 56 deletions(-)
diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c index 8febea6..58bcb97 100644 --- a/dlls/comctl32/comboex.c +++ b/dlls/comctl32/comboex.c @@ -1580,10 +1580,8 @@ static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr) if (infoPtr->hwndCombo) DestroyWindow (infoPtr->hwndCombo);
- if (infoPtr->edit) { - Free (infoPtr->edit); - infoPtr->edit = 0; - } + Free (infoPtr->edit); + infoPtr->edit = 0;
if (infoPtr->items) { CBE_ITEMDATA *item, *next; diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c index d18390e..7ef2c33 100644 --- a/dlls/comctl32/comctl32undoc.c +++ b/dlls/comctl32/comctl32undoc.c @@ -954,10 +954,8 @@ BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc) *lppDest = ptr; } else { - if (*lppDest) { - Free (*lppDest); - *lppDest = NULL; - } + Free (*lppDest); + *lppDest = NULL; }
return TRUE; @@ -994,10 +992,8 @@ BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc) *lppDest = ptr; } else { - if (*lppDest) { - Free (*lppDest); - *lppDest = NULL; - } + Free (*lppDest); + *lppDest = NULL; }
return TRUE; diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c index 2915389..4907fdf 100644 --- a/dlls/comctl32/header.c +++ b/dlls/comctl32/header.c @@ -957,12 +957,12 @@ HEADER_PrepareCallbackItems(HWND hwnd, INT iItem, INT reqMask) static void HEADER_FreeCallbackItems(HEADER_ITEM *lpItem) { - if (lpItem->callbackMask&HDI_TEXT && lpItem->pszText != NULL) + if (lpItem->callbackMask&HDI_TEXT) { Free(lpItem->pszText); lpItem->pszText = NULL; } - + if (lpItem->callbackMask&HDI_IMAGE) lpItem->iImage = I_IMAGECALLBACK; } diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index e9e4aff..06ce339 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -2404,7 +2404,7 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg, { PROPSHEETPAGEW* psp = (PROPSHEETPAGEW*)psInfo->proppage[index].hpage;
- if ((psp->dwFlags & PSP_USETITLE) && psInfo->proppage[index].pszText) + if (psp->dwFlags & PSP_USETITLE) Free ((LPVOID)psInfo->proppage[index].pszText);
DestroyPropertySheetPage(psInfo->proppage[index].hpage); @@ -2719,7 +2719,7 @@ static void PROPSHEET_CleanUp(HWND hwndDlg)
if(psp) { - if ((psp->dwFlags & PSP_USETITLE) && psInfo->proppage[i].pszText) + if (psp->dwFlags & PSP_USETITLE) Free ((LPVOID)psInfo->proppage[i].pszText);
DestroyPropertySheetPage(psInfo->proppage[i].hpage); diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index 3ea8fe9..2972ab2 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -2750,10 +2750,8 @@ REBAR_Destroy (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) lpBand = &infoPtr->bands[i];
/* delete text strings */ - if (lpBand->lpText) { - Free (lpBand->lpText); - lpBand->lpText = NULL; - } + Free (lpBand->lpText); + lpBand->lpText = NULL; /* destroy child window */ DestroyWindow (lpBand->hwndChild); } diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c index 719e545..82c784d 100644 --- a/dlls/comctl32/status.c +++ b/dlls/comctl32/status.c @@ -662,7 +662,7 @@ STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts) infoPtr->numParts = count; if (oldNumParts > infoPtr->numParts) { for (i = infoPtr->numParts ; i < oldNumParts; i++) { - if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW)) + if (!(infoPtr->parts[i].style & SBT_OWNERDRAW)) Free (infoPtr->parts[i].text); } } else if (oldNumParts < infoPtr->numParts) { @@ -671,8 +671,7 @@ STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts) for (i = 0; i < oldNumParts; i++) { tmp[i] = infoPtr->parts[i]; } - if (infoPtr->parts) - Free (infoPtr->parts); + Free (infoPtr->parts); infoPtr->parts = tmp; } if (oldNumParts == infoPtr->numParts) { @@ -751,10 +750,9 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style, oldStyle = part->style; part->style = style; if (style & SBT_OWNERDRAW) { - if (!(oldStyle & SBT_OWNERDRAW)) { - if (part->text) - Free (part->text); - } else if (part->text == text) + if (!(oldStyle & SBT_OWNERDRAW)) + Free (part->text); + else if (part->text == text) return TRUE; part->text = (LPWSTR)text; } else { @@ -783,7 +781,7 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style, return TRUE; }
- if (part->text && !(oldStyle & SBT_OWNERDRAW)) + if (!(oldStyle & SBT_OWNERDRAW)) Free (part->text); part->text = ntext; } @@ -870,10 +868,10 @@ STATUSBAR_WMDestroy (STATUS_INFO *infoPtr)
TRACE("\n"); for (i = 0; i < infoPtr->numParts; i++) { - if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW)) + if (!(infoPtr->parts[i].style & SBT_OWNERDRAW)) Free (infoPtr->parts[i].text); } - if (infoPtr->part0.text && !(infoPtr->part0.style & SBT_OWNERDRAW)) + if (!(infoPtr->part0.style & SBT_OWNERDRAW)) Free (infoPtr->part0.text); Free (infoPtr->parts);
@@ -1138,8 +1136,7 @@ STATUSBAR_WMSetText (STATUS_INFO *infoPtr, LPCSTR text)
part = &infoPtr->parts[0]; /* duplicate string */ - if (part->text) - Free (part->text); + Free (part->text); part->text = 0; if (infoPtr->bUnicode) { if (text && (len = strlenW((LPCWSTR)text))) { diff --git a/dlls/comctl32/string.c b/dlls/comctl32/string.c index c362081..33effbd 100644 --- a/dlls/comctl32/string.c +++ b/dlls/comctl32/string.c @@ -215,10 +215,8 @@ BOOL WINAPI Str_SetPtrA (LPSTR *lppDest, LPCSTR lpSrc) *lppDest = ptr; } else { - if (*lppDest) { - Free (*lppDest); - *lppDest = NULL; - } + Free (*lppDest); + *lppDest = NULL; }
return TRUE; @@ -274,10 +272,8 @@ BOOL WINAPI Str_SetPtrW (LPWSTR *lppDest, LPCWSTR lpSrc) *lppDest = ptr; } else { - if (*lppDest) { - Free (*lppDest); - *lppDest = NULL; - } + Free (*lppDest); + *lppDest = NULL; }
return TRUE; diff --git a/dlls/comctl32/syslink.c b/dlls/comctl32/syslink.c index d631244..fcf253d 100644 --- a/dlls/comctl32/syslink.c +++ b/dlls/comctl32/syslink.c @@ -675,23 +675,20 @@ static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc, PRECT pRect) PDOC_TEXTBLOCK bl, cbl; INT nFit; SIZE szDim; - + if(Current->nText == 0) { continue; } - + tx = Current->Text; n = Current->nText;
- if (Current->Blocks != NULL) - { - Free(Current->Blocks); - Current->Blocks = NULL; - } + Free(Current->Blocks); + Current->Blocks = NULL; bl = NULL; nBlocks = 0; - + if(Current->Type == slText) { SelectObject(hdc, infoPtr->Font); diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index cbb4cdd..711c320 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c @@ -2768,11 +2768,8 @@ TAB_SetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode)
if (tabItem->mask & TCIF_TEXT) { - if (wineItem->pszText) - { - Free(wineItem->pszText); - wineItem->pszText = NULL; - } + Free(wineItem->pszText); + wineItem->pszText = NULL; if (bUnicode) Str_SetPtrW(&wineItem->pszText, tabItem->pszText); else diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index a60bf09..86d3ffc 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -5385,8 +5385,7 @@ TOOLBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) Free (infoPtr->bitmaps); /* bitmaps list */
/* delete button data */ - if (infoPtr->buttons) - Free (infoPtr->buttons); + Free (infoPtr->buttons);
/* delete strings */ if (infoPtr->strings) { diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index 7fbe3c9..c5801a1 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -831,7 +831,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L break;
case WM_DESTROY: - if(infoPtr->AccelVect) Free (infoPtr->AccelVect); + Free (infoPtr->AccelVect);
if(infoPtr->Buddy) RemovePropW(infoPtr->Buddy, BUDDY_UPDOWN_HWND);