From: Indrek Altpere Subject: [1/2] winemenubuilder: cleanup of open_file_type_icon Message-Id: Date: Fri, 29 Aug 2014 16:09:59 +0300 Removed unused variable output_path. Consolidated the icon association search and executable fallback into tighter flow, reusing the same variables. diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 09402af..5d16022 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -1021,39 +1014,36 @@ static HRESULT open_file_type_icon(LPCWSTR szFileName, IStream **ppStream) { static const WCHAR openW[] = {'o','p','e','n',0}; WCHAR *extension; - WCHAR *icon = NULL; + WCHAR *target = NULL; WCHAR *comma; - WCHAR *executable = NULL; int index = 0; - char *output_path = NULL; HRESULT hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND); extension = strrchrW(szFileName, '.'); if (extension == NULL) goto end; - icon = assoc_query(ASSOCSTR_DEFAULTICON, extension, NULL); - if (icon) + target = assoc_query(ASSOCSTR_DEFAULTICON, extension, NULL); + if (target) { - comma = strrchrW(icon, ','); + comma = strrchrW(target, ','); if (comma) { *comma = 0; index = atoiW(comma + 1); } - hr = open_icon(icon, index, FALSE, ppStream); } else { - executable = assoc_query(ASSOCSTR_EXECUTABLE, extension, openW); - if (executable) - hr = open_icon(executable, 0, FALSE, ppStream); + target = assoc_query(ASSOCSTR_EXECUTABLE, extension, openW); + if (!target) + goto end; } + hr = open_icon(target, index, FALSE, ppStream); + end: - HeapFree(GetProcessHeap(), 0, icon); - HeapFree(GetProcessHeap(), 0, executable); - HeapFree(GetProcessHeap(), 0, output_path); + HeapFree(GetProcessHeap(), 0, target); return hr; }