wusa: Remove string duplication helper.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
76fa97cddd
commit
7e446ce7e7
|
@ -166,7 +166,7 @@ static BOOL create_directory(const WCHAR *path)
|
||||||
|
|
||||||
static BOOL create_parent_directory(const WCHAR *filename)
|
static BOOL create_parent_directory(const WCHAR *filename)
|
||||||
{
|
{
|
||||||
WCHAR *p, *path = strdupW(filename);
|
WCHAR *p, *path = wcsdup(filename);
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
if (!path) return FALSE;
|
if (!path) return FALSE;
|
||||||
|
@ -430,7 +430,7 @@ static struct assembly_entry *lookup_assembly(struct list *manifest_list, struct
|
||||||
|
|
||||||
static WCHAR *get_assembly_source(struct assembly_entry *assembly)
|
static WCHAR *get_assembly_source(struct assembly_entry *assembly)
|
||||||
{
|
{
|
||||||
WCHAR *p, *path = strdupW(assembly->filename);
|
WCHAR *p, *path = wcsdup(assembly->filename);
|
||||||
if (path && (p = wcsrchr(path, '.'))) *p = 0;
|
if (path && (p = wcsrchr(path, '.'))) *p = 0;
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *ke
|
||||||
if (!wcsicmp(key, L"runtime.inf")) wcscat(path, L"\\inf");
|
if (!wcsicmp(key, L"runtime.inf")) wcscat(path, L"\\inf");
|
||||||
else if (!wcsicmp(key, L"runtime.drivers")) wcscat(path, L"\\drivers");
|
else if (!wcsicmp(key, L"runtime.drivers")) wcscat(path, L"\\drivers");
|
||||||
else if (!wcsicmp(key, L"runtime.wbem")) wcscat(path, L"\\wbem");
|
else if (!wcsicmp(key, L"runtime.wbem")) wcscat(path, L"\\wbem");
|
||||||
return strdupW(path);
|
return wcsdup(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WCHAR *expand_expression(struct assembly_entry *assembly, const WCHAR *expression)
|
static WCHAR *expand_expression(struct assembly_entry *assembly, const WCHAR *expression)
|
||||||
|
|
|
@ -160,7 +160,7 @@ static WCHAR *get_xml_attribute(IXMLDOMElement *root, const WCHAR *name)
|
||||||
VariantInit(&var);
|
VariantInit(&var);
|
||||||
if (SUCCEEDED(IXMLDOMElement_getAttribute(root, bstr, &var)))
|
if (SUCCEEDED(IXMLDOMElement_getAttribute(root, bstr, &var)))
|
||||||
{
|
{
|
||||||
ret = (V_VT(&var) == VT_BSTR) ? strdupW(V_BSTR(&var)) : NULL;
|
ret = (V_VT(&var) == VT_BSTR) ? wcsdup(V_BSTR(&var)) : NULL;
|
||||||
VariantClear(&var);
|
VariantClear(&var);
|
||||||
}
|
}
|
||||||
SysFreeString(bstr);
|
SysFreeString(bstr);
|
||||||
|
@ -554,7 +554,7 @@ struct assembly_entry *load_manifest(const WCHAR *filename)
|
||||||
|
|
||||||
if ((entry = alloc_assembly()))
|
if ((entry = alloc_assembly()))
|
||||||
{
|
{
|
||||||
entry->filename = strdupW(filename);
|
entry->filename = wcsdup(filename);
|
||||||
entry->displayname = get_xml_attribute(root, L"displayName");
|
entry->displayname = get_xml_attribute(root, L"displayName");
|
||||||
if (iter_assembly(root, entry)) goto done;
|
if (iter_assembly(root, entry)) goto done;
|
||||||
free_assembly(entry);
|
free_assembly(entry);
|
||||||
|
|
|
@ -100,14 +100,6 @@ static inline WCHAR *strdupAtoW(const char *str)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline WCHAR *strdupW(const WCHAR *str)
|
|
||||||
{
|
|
||||||
WCHAR *ret;
|
|
||||||
if (!str) return NULL;
|
|
||||||
if ((ret = malloc((lstrlenW(str) + 1) * sizeof(WCHAR)))) lstrcpyW(ret, str);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline WCHAR *strdupWn(const WCHAR *str, DWORD len)
|
static inline WCHAR *strdupWn(const WCHAR *str, DWORD len)
|
||||||
{
|
{
|
||||||
WCHAR *ret;
|
WCHAR *ret;
|
||||||
|
|
Loading…
Reference in New Issue