mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-03 00:59:33 +03:00
libvirt_charPtrUnwrap: remove unnecessary check of returned string
Function libvirt_charPtrUnwrap() either fails or always sets the unwrapped string so there is no need to check it explicitly. Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
@ -302,8 +302,7 @@ setPyVirTypedParameter(PyObject *info,
|
||||
while (PyDict_Next(info, &pos, &key, &value)) {
|
||||
char *keystr = NULL;
|
||||
|
||||
if (libvirt_charPtrUnwrap(key, &keystr) < 0 ||
|
||||
keystr == NULL)
|
||||
if (libvirt_charPtrUnwrap(key, &keystr) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0; i < nparams; i++) {
|
||||
@ -359,8 +358,7 @@ setPyVirTypedParameter(PyObject *info,
|
||||
case VIR_TYPED_PARAM_STRING:
|
||||
{
|
||||
char *string_val;
|
||||
if (libvirt_charPtrUnwrap(value, &string_val) < 0 ||
|
||||
!string_val)
|
||||
if (libvirt_charPtrUnwrap(value, &string_val) < 0)
|
||||
goto cleanup;
|
||||
temp->value.s = string_val;
|
||||
break;
|
||||
@ -489,7 +487,6 @@ virPyDictToTypedParamOne(virTypedParameterPtr *params,
|
||||
{
|
||||
char *val;;
|
||||
if (libvirt_charPtrUnwrap(value, &val) < 0 ||
|
||||
!val ||
|
||||
virTypedParamsAddString(params, n, max, keystr, val) < 0) {
|
||||
VIR_FREE(val);
|
||||
goto cleanup;
|
||||
@ -541,8 +538,7 @@ virPyDictToTypedParams(PyObject *dict,
|
||||
return -1;
|
||||
|
||||
while (PyDict_Next(dict, &pos, &key, &value)) {
|
||||
if (libvirt_charPtrUnwrap(key, &keystr) < 0 ||
|
||||
!keystr)
|
||||
if (libvirt_charPtrUnwrap(key, &keystr) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (PyList_Check(value) || PyTuple_Check(value)) {
|
||||
|
Reference in New Issue
Block a user