Commit 22fa68bb authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

wbemprox: Remove string duplication helper.

parent c867e2da
...@@ -783,7 +783,7 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI ...@@ -783,7 +783,7 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI
hr = IWbemClassObject_Get( param, L"Parameter", 0, &val, NULL, NULL ); hr = IWbemClassObject_Get( param, L"Parameter", 0, &val, NULL, NULL );
if (hr != S_OK) goto error; if (hr != S_OK) goto error;
columns[i].name = heap_strdupW( V_BSTR( &val ) ); columns[i].name = wcsdup( V_BSTR( &val ) );
VariantClear( &val ); VariantClear( &val );
hr = IWbemClassObject_Get( param, L"Type", 0, &val, NULL, NULL ); hr = IWbemClassObject_Get( param, L"Type", 0, &val, NULL, NULL );
...@@ -1068,7 +1068,7 @@ HRESULT create_class_object( enum wbm_namespace ns, const WCHAR *name, IEnumWbem ...@@ -1068,7 +1068,7 @@ HRESULT create_class_object( enum wbm_namespace ns, const WCHAR *name, IEnumWbem
co->IWbemClassObject_iface.lpVtbl = &class_object_vtbl; co->IWbemClassObject_iface.lpVtbl = &class_object_vtbl;
co->refs = 1; co->refs = 1;
if (!name) co->name = NULL; if (!name) co->name = NULL;
else if (!(co->name = heap_strdupW( name ))) else if (!(co->name = wcsdup( name )))
{ {
free( co ); free( co );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
...@@ -282,13 +282,13 @@ HRESULT WbemQualifierSet_create( enum wbm_namespace ns, const WCHAR *class, cons ...@@ -282,13 +282,13 @@ HRESULT WbemQualifierSet_create( enum wbm_namespace ns, const WCHAR *class, cons
if (!(set = malloc( sizeof(*set) ))) return E_OUTOFMEMORY; if (!(set = malloc( sizeof(*set) ))) return E_OUTOFMEMORY;
set->IWbemQualifierSet_iface.lpVtbl = &qualifier_set_vtbl; set->IWbemQualifierSet_iface.lpVtbl = &qualifier_set_vtbl;
if (!(set->class = heap_strdupW( class ))) if (!(set->class = wcsdup( class )))
{ {
free( set ); free( set );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
if (!member) set->member = NULL; if (!member) set->member = NULL;
else if (!(set->member = heap_strdupW( member ))) else if (!(set->member = wcsdup( member )))
{ {
free( set->class ); free( set->class );
free( set ); free( set );
......
...@@ -1298,7 +1298,7 @@ static struct array *to_array( VARIANT *var, CIMTYPE *type ) ...@@ -1298,7 +1298,7 @@ static struct array *to_array( VARIANT *var, CIMTYPE *type )
destroy_array( ret, basetype ); destroy_array( ret, basetype );
return NULL; return NULL;
} }
*(WCHAR **)ptr = heap_strdupW( str ); *(WCHAR **)ptr = wcsdup( str );
SysFreeString( str ); SysFreeString( str );
if (!*(WCHAR **)ptr) if (!*(WCHAR **)ptr)
{ {
...@@ -1336,7 +1336,7 @@ HRESULT to_longlong( VARIANT *var, LONGLONG *val, CIMTYPE *type ) ...@@ -1336,7 +1336,7 @@ HRESULT to_longlong( VARIANT *var, LONGLONG *val, CIMTYPE *type )
*type = CIM_BOOLEAN; *type = CIM_BOOLEAN;
break; break;
case VT_BSTR: case VT_BSTR:
*val = (INT_PTR)heap_strdupW( V_BSTR( var ) ); *val = (INT_PTR)wcsdup( V_BSTR( var ) );
if (!*val) return E_OUTOFMEMORY; if (!*val) return E_OUTOFMEMORY;
*type = CIM_STRING; *type = CIM_STRING;
break; break;
......
...@@ -749,7 +749,7 @@ static HRESULT WINAPI wbem_services_ExecQueryAsync( ...@@ -749,7 +749,7 @@ static HRESULT WINAPI wbem_services_ExecQueryAsync(
free_async( async ); free_async( async );
goto done; goto done;
} }
if (!(query->str = heap_strdupW( strQuery ))) if (!(query->str = wcsdup( strQuery )))
{ {
free_async( async ); free_async( async );
goto done; goto done;
...@@ -818,7 +818,7 @@ static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync( ...@@ -818,7 +818,7 @@ static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync(
free_async( async ); free_async( async );
goto done; goto done;
} }
if (!(query->str = heap_strdupW( strQuery ))) if (!(query->str = wcsdup( strQuery )))
{ {
free_async( async ); free_async( async );
goto done; goto done;
...@@ -1152,7 +1152,7 @@ static HRESULT WINAPI wbem_context_SetValue( ...@@ -1152,7 +1152,7 @@ static HRESULT WINAPI wbem_context_SetValue(
else else
{ {
if (!(value = calloc( 1, sizeof(*value) ))) return E_OUTOFMEMORY; if (!(value = calloc( 1, sizeof(*value) ))) return E_OUTOFMEMORY;
if (!(value->name = heap_strdupW( name ))) if (!(value->name = wcsdup( name )))
{ {
free( value ); free( value );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
...@@ -376,7 +376,7 @@ struct table *create_table( const WCHAR *name, UINT num_cols, const struct colum ...@@ -376,7 +376,7 @@ struct table *create_table( const WCHAR *name, UINT num_cols, const struct colum
struct table *table; struct table *table;
if (!(table = malloc( sizeof(*table) ))) return NULL; if (!(table = malloc( sizeof(*table) ))) return NULL;
table->name = heap_strdupW( name ); table->name = wcsdup( name );
table->num_cols = num_cols; table->num_cols = num_cols;
table->columns = columns; table->columns = columns;
table->num_rows = num_rows; table->num_rows = num_rows;
......
...@@ -275,14 +275,6 @@ HRESULT sysrestore_enable(IWbemClassObject *obj, IWbemContext *context, IWbemCla ...@@ -275,14 +275,6 @@ HRESULT sysrestore_enable(IWbemClassObject *obj, IWbemContext *context, IWbemCla
HRESULT sysrestore_get_last_status(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN; HRESULT sysrestore_get_last_status(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
HRESULT sysrestore_restore(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN; HRESULT sysrestore_restore(IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out) DECLSPEC_HIDDEN;
static inline WCHAR *heap_strdupW( const WCHAR *src )
{
WCHAR *dst;
if (!src) return NULL;
if ((dst = malloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src );
return dst;
}
static inline WCHAR *heap_strdupAW( const char *src ) static inline WCHAR *heap_strdupAW( const char *src )
{ {
int len; int len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment