[libvirt] [PATCH 2/8] virTypedParamsValidate: do not use STREQ_NULLABLE

Ján Tomko jtomko at redhat.com
Wed Jun 29 13:53:55 UTC 2016


The field cannot be non-NULL. Only check last_name for NULL to make
clang happy:

util/virtypedparam.c:109:104: error: address of array 'sorted[i].field'
will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]

  if (((last_name) ? (sorted[i].field) && (strcmp((last_name)
                                                  ?
                                                  (last_name)
                                                  : "",
                                                  (sorted[i].field)
                                                  ?
                                                  (sorted[i].field)
                                                  : "") == 0)
       : !(sorted[i].field)) &&
---
 src/util/virtypedparam.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c
index 23109e1..6013688 100644
--- a/src/util/virtypedparam.c
+++ b/src/util/virtypedparam.c
@@ -106,7 +106,7 @@ virTypedParamsValidate(virTypedParameterPtr params, int nparams, ...)
         if (STRNEQ(sorted[i].field, keys[j].field)) {
             j++;
         } else {
-            if (STREQ_NULLABLE(last_name, sorted[i].field) &&
+            if (last_name && STREQ(last_name, sorted[i].field) &&
                 !(keys[j].value.i & VIR_TYPED_PARAM_MULTIPLE)) {
                 virReportError(VIR_ERR_INVALID_ARG,
                                _("parameter '%s' occurs multiple times"),
-- 
2.7.3




More information about the libvir-list mailing list