hyperv: Accept const @value in hypervSetEmbeddedProperty()
The hypervSetEmbeddedProperty() function is used to update a value for given property in a list of properties created by hypervCreateEmbeddedParam(). The list is nothing fancy - it's a virHashTable that has NULL as dataFree callback => the table does not own the value. This is not that obvious since hypervSetEmbeddedProperty() accepts a non-const pointer. This fact makes it unnecessary hard to consume, e.g. if we wanted to pass a stack allocated string. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Matt Coleman <matt@datto.com>
This commit is contained in:
parent
e257493441
commit
b54b229e74
@ -351,10 +351,26 @@ hypervCreateEmbeddedParam(hypervPrivate *priv, hypervWmiClassInfoListPtr info)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hypervSetEmbeddedProperty:
|
||||||
|
* @table: hash table allocated earlier by hypervCreateEmbeddedParam()
|
||||||
|
* @name: name of the property
|
||||||
|
* @value: value of the property
|
||||||
|
*
|
||||||
|
* For given table of properties, set property of @name to @value.
|
||||||
|
* Please note, that the hash table does NOT become owner of the @value and
|
||||||
|
* thus caller must ensure the pointer validity.
|
||||||
|
*
|
||||||
|
* Returns: 0 on success,
|
||||||
|
* -1 otherwise.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
hypervSetEmbeddedProperty(virHashTablePtr table, const char *name, char *value)
|
hypervSetEmbeddedProperty(virHashTablePtr table,
|
||||||
|
const char *name,
|
||||||
|
const char *value)
|
||||||
{
|
{
|
||||||
return virHashUpdateEntry(table, name, value);
|
return virHashUpdateEntry(table, name, (void*) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -146,8 +146,9 @@ int hypervAddEprParam(hypervInvokeParamsListPtr params, const char *name,
|
|||||||
virHashTablePtr hypervCreateEmbeddedParam(hypervPrivate *priv,
|
virHashTablePtr hypervCreateEmbeddedParam(hypervPrivate *priv,
|
||||||
hypervWmiClassInfoListPtr info);
|
hypervWmiClassInfoListPtr info);
|
||||||
|
|
||||||
int hypervSetEmbeddedProperty(virHashTablePtr table, const char *name,
|
int hypervSetEmbeddedProperty(virHashTablePtr table,
|
||||||
char *value);
|
const char *name,
|
||||||
|
const char *value);
|
||||||
|
|
||||||
int hypervAddEmbeddedParam(hypervInvokeParamsListPtr params,
|
int hypervAddEmbeddedParam(hypervInvokeParamsListPtr params,
|
||||||
hypervPrivate *priv,
|
hypervPrivate *priv,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user