diff options
author | Pavel Hrdina <phrdina@redhat.com> | 2018-06-12 07:12:15 +0200 |
---|---|---|
committer | Pavel Hrdina <phrdina@redhat.com> | 2018-06-12 10:27:38 +0200 |
commit | a950b083177934aebab8c1902699e5ae77033b4d (patch) | |
tree | 50158bc611ad923ac9dd4bded6782f0faf48b63f /libvirt-utils.c | |
parent | 0c2d0c9be9d6bfeaca6acf1d11cf5a16f4e229a8 (diff) | |
download | libvirt-python-a950b083177934aebab8c1902699e5ae77033b4d.tar.gz |
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>
Diffstat (limited to 'libvirt-utils.c')
-rw-r--r-- | libvirt-utils.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libvirt-utils.c b/libvirt-utils.c index e17e794..78b94ca 100644 --- a/libvirt-utils.c +++ b/libvirt-utils.c @@ -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)) { |