]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Avoid using !STREQ and !STRNEQ
authorIshmanpreet Kaur Khera <khera.ishman@gmail.com>
Tue, 20 Oct 2015 16:15:12 +0000 (21:45 +0530)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 21 Oct 2015 13:03:35 +0000 (15:03 +0200)
We have macros for both positive and negative string matching.
Therefore there is no need to use !STREQ or !STRNEQ. At the same
time as we are dropping this, new syntax-check rule is
introduced to make sure we won't introduce it again.

Signed-off-by: Ishmanpreet Kaur Khera <khera.ishman@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
29 files changed:
cfg.mk
src/bhyve/bhyve_driver.c
src/conf/network_conf.c
src/conf/nwfilter_conf.c
src/conf/nwfilter_params.c
src/conf/storage_conf.c
src/lxc/lxc_fuse.c
src/openvz/openvz_driver.c
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
src/qemu/qemu_hotplug.c
src/security/security_manager.c
src/security/security_selinux.c
src/storage/storage_backend_logical.c
src/util/virfile.c
src/util/virsystemd.c
src/vz/vz_driver.c
src/vz/vz_sdk.c
src/xen/xend_internal.c
src/xenconfig/xen_sxpr.c
tests/commandtest.c
tests/securityselinuxlabeltest.c
tests/virauthconfigtest.c
tests/virbitmaptest.c
tests/vircgrouptest.c
tests/virkeyfiletest.c
tests/virnetsockettest.c
tests/virtypedparamtest.c
tests/viruritest.c

diff --git a/cfg.mk b/cfg.mk
index 391f37b4c7c63f3d47fe28ff0f1ded7ddd8a9350..a9bba382d7b0b3afe458808bb3f8c795f2a68f5c 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -1011,6 +1011,16 @@ sc_prohibit_pthread_create:
        halt="avoid using 'pthread_create', use 'virThreadCreate' instead" \
          $(_sc_search_regexp)
 
+sc_prohibit_not_streq:
+       @prohibit='! *STREQ *\(.*\)'            \
+       halt='Use STRNEQ instead of !STREQ'     \
+         $(_sc_search_regexp)
+
+sc_prohibit_not_strneq:
+       @prohibit='! *STRNEQ *\(.*\)'       \
+       halt='Use STREQ instead of !STRNEQ'     \
+         $(_sc_search_regexp)
+
 # We don't use this feature of maint.mk.
 prev_version_file = /dev/null
 
@@ -1213,3 +1223,9 @@ exclude_file_name_regexp--sc_prohibit_sysconf_pagesize = \
 
 exclude_file_name_regexp--sc_prohibit_pthread_create = \
   ^(cfg\.mk|src/util/virthread\.c|tests/.*)$$
+
+exclude_file_name_regexp--sc_prohibit_not_streq = \
+  ^tests/.*\.[ch]$$
+
+exclude_file_name_regexp--sc_prohibit_not_strneq = \
+  ^tests/.*\.[ch]$$
index d44cf2c579841fe8c0bc32f155850c6f2cfce406..e5d56e98d89171418b2bc2b70c0611c70d81be74 100644 (file)
@@ -197,7 +197,7 @@ bhyveConnectOpen(virConnectPtr conn,
          if (conn->uri->server)
              return VIR_DRV_OPEN_DECLINED;
 
-         if (!STREQ_NULLABLE(conn->uri->path, "/system")) {
+         if (STRNEQ_NULLABLE(conn->uri->path, "/system")) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unexpected bhyve URI path '%s', try bhyve:///system"),
                            conn->uri->path);
index c1cbd76c68078c92434a0324b25e1e67a0a79eea..0ffb3253e8c270493b1637ec5f8281c14ea379f8 100644 (file)
@@ -3042,7 +3042,7 @@ virNetworkLoadState(virNetworkObjListPtr nets,
     if (!(def = virNetworkDefParseXML(ctxt)))
         goto error;
 
-    if (!STREQ(name, def->name)) {
+    if (STRNEQ(name, def->name)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Network config filename '%s'"
                          " does not match network name '%s'"),
@@ -3152,7 +3152,7 @@ virNetworkObjPtr virNetworkLoadConfig(virNetworkObjListPtr nets,
     if (!(def = virNetworkDefParseFile(configFile)))
         goto error;
 
-    if (!STREQ(name, def->name)) {
+    if (STRNEQ(name, def->name)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Network config filename '%s'"
                          " does not match network name '%s'"),
index f7ccb757447174e11bf2a8388a3885e76e44cef9..ced8eb8b050f3bf8b4f9e7c0e9bb5eb6b40f9798 100644 (file)
@@ -3082,7 +3082,7 @@ virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters,
     nwfilter = virNWFilterObjFindByUUID(nwfilters, def->uuid);
 
     if (nwfilter) {
-        if (!STREQ(def->name, nwfilter->def->name)) {
+        if (STRNEQ(def->name, nwfilter->def->name)) {
             virReportError(VIR_ERR_OPERATION_FAILED,
                            _("filter with same UUID but different name "
                              "('%s') already exists"),
index 0ac8baa5a8312ba899b79ffe999efe1ca28172d8..b6c6e78ee68074623e92da87bc668bf3ee0a8b1f 100644 (file)
@@ -444,7 +444,7 @@ virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
                     /* should never occur to step on a NULL here */
                     return true;
                 }
-                if (!STREQ(virNWFilterVarValueGetNthValue(tmp, cie->curValue),
+                if (STRNEQ(virNWFilterVarValueGetNthValue(tmp, cie->curValue),
                            virNWFilterVarValueGetNthValue(tmp, i))) {
                     isSame = false;
                     break;
index 9dae1a39bb5bfee3f56ee928059c05affd1aefde..9b8abea7958e1574838b8fe7e8ca99c57fec8c09 100644 (file)
@@ -1873,7 +1873,7 @@ virStoragePoolLoadState(virStoragePoolObjListPtr pools,
     if (!(def = virStoragePoolDefParseXML(ctxt)))
         goto error;
 
-    if (!STREQ(name, def->name)) {
+    if (STRNEQ(name, def->name)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Storage pool state file '%s' does not match "
                          "pool name '%s'"),
index 34a69cc21996bb537641b962666430f5f779037f..862dca3a70deb3a16680d447518368df1212af69 100644 (file)
@@ -90,7 +90,7 @@ static int lxcProcReaddir(const char *path, void *buf,
                           off_t offset ATTRIBUTE_UNUSED,
                           struct fuse_file_info *fi ATTRIBUTE_UNUSED)
 {
-    if (!STREQ(path, "/"))
+    if (STRNEQ(path, "/"))
         return -ENOENT;
 
     filler(buf, ".", NULL, 0);
@@ -103,7 +103,7 @@ static int lxcProcReaddir(const char *path, void *buf,
 static int lxcProcOpen(const char *path ATTRIBUTE_UNUSED,
                        struct fuse_file_info *fi ATTRIBUTE_UNUSED)
 {
-    if (!STREQ(path, fuse_meminfo_path))
+    if (STRNEQ(path, fuse_meminfo_path))
         return -ENOENT;
 
     if ((fi->flags & 3) != O_RDONLY)
index d78e2f547adf717e42712649871d77f34dbc8c88..b8c0f50106075aac89a04788656d109e9a970370 100644 (file)
@@ -2048,7 +2048,7 @@ openvzUpdateDevice(virDomainDefPtr vmdef,
         cur = vmdef->fss[pos];
 
         /* We only allow updating the quota */
-        if (!STREQ(cur->src, fs->src)
+        if (STRNEQ(cur->src, fs->src)
             || cur->type != fs->type
             || cur->accessmode != fs->accessmode
             || cur->wrpolicy != fs->wrpolicy
index 7b0879d5cc09d6698850bbb994cd4ce25a16187b..882454156df36e9b6a069af49ac245839168510d 100644 (file)
@@ -3008,7 +3008,7 @@ qemuParseDriveURIString(virDomainDiskDefPtr def, virURIPtr uri,
     if (transp)
         *transp++ = 0;
 
-    if (!STREQ(uri->scheme, scheme)) {
+    if (STRNEQ(uri->scheme, scheme)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Invalid transport/scheme '%s'"), uri->scheme);
         goto error;
@@ -10027,7 +10027,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         virDomainDiskDefPtr disk = def->disks[i];
 
         if (disk->src->driverName != NULL &&
-            !STREQ(disk->src->driverName, "qemu")) {
+            STRNEQ(disk->src->driverName, "qemu")) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unsupported driver name '%s' for disk '%s'"),
                            disk->src->driverName, disk->src->path);
@@ -12725,7 +12725,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
             if (VIR_STRDUP(model, tokens[i]) < 0)
                 goto cleanup;
 
-            if (!STREQ(model, "qemu32") && !STREQ(model, "qemu64")) {
+            if (STRNEQ(model, "qemu32") && STRNEQ(model, "qemu64")) {
                 if (!(cpu = qemuInitGuestCPU(dom)))
                     goto cleanup;
 
index bdc0e674337e3aa3db6f31047d39e396481ab3d5..890d8ed1117e5dc704b569ad4109d6e443abc41c 100644 (file)
@@ -1061,7 +1061,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
         if (!STRPREFIX(def->os.machine, "pc-0.") &&
             !STRPREFIX(def->os.machine, "pc-1.") &&
             !STRPREFIX(def->os.machine, "pc-i440") &&
-            !STREQ(def->os.machine, "pc") &&
+            STRNEQ(def->os.machine, "pc") &&
             !STRPREFIX(def->os.machine, "rhel"))
             break;
         addPCIRoot = true;
index afc54080b858a503a860c7c593b2acb5f7246d46..470ab6ad32374ec73b85a81c51c59f24dc3f0b35 100644 (file)
@@ -783,7 +783,7 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
     const char *driverName = virDomainDiskGetDriver(disk);
     const char *src = virDomainDiskGetSource(disk);
 
-    if (driverName && !STREQ(driverName, "qemu")) {
+    if (driverName && STRNEQ(driverName, "qemu")) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unsupported driver name '%s' for disk '%s'"),
                        driverName, src);
index 5b05a478c964b2302e1ec5bedd4c738378025c04..07a05224e0be10bcb935411514bbaa22f6f8de8f 100644 (file)
@@ -130,7 +130,7 @@ int
 virSecurityManagerStackAddNested(virSecurityManagerPtr stack,
                                  virSecurityManagerPtr nested)
 {
-    if (!STREQ("stack", stack->drv->name))
+    if (STRNEQ("stack", stack->drv->name))
         return -1;
     return virSecurityStackAddNested(stack, nested);
 }
index c2464c2bfba173312b10edcd6c8fcfd764bb08fa..80b08864d88019c48d3d83fcfb8cdf4422f5f948 100644 (file)
@@ -2061,7 +2061,7 @@ virSecuritySELinuxSecurityVerify(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
     if (secdef == NULL)
         return 0;
 
-    if (!STREQ(SECURITY_SELINUX_NAME, secdef->model)) {
+    if (STRNEQ(SECURITY_SELINUX_NAME, secdef->model)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("security label driver mismatch: "
                          "'%s' model configured for domain, but "
@@ -2092,7 +2092,7 @@ virSecuritySELinuxSetSecurityProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UN
         return 0;
 
     VIR_DEBUG("label=%s", secdef->label);
-    if (!STREQ(SECURITY_SELINUX_NAME, secdef->model)) {
+    if (STRNEQ(SECURITY_SELINUX_NAME, secdef->model)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("security label driver mismatch: "
                          "'%s' model configured for domain, but "
@@ -2126,7 +2126,7 @@ virSecuritySELinuxSetSecurityChildProcessLabel(virSecurityManagerPtr mgr ATTRIBU
         return 0;
 
     VIR_DEBUG("label=%s", secdef->label);
-    if (!STREQ(SECURITY_SELINUX_NAME, secdef->model)) {
+    if (STRNEQ(SECURITY_SELINUX_NAME, secdef->model)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("security label driver mismatch: "
                          "'%s' model configured for domain, but "
@@ -2155,7 +2155,7 @@ virSecuritySELinuxSetSecurityDaemonSocketLabel(virSecurityManagerPtr mgr ATTRIBU
     if (!secdef || !secdef->label)
         return 0;
 
-    if (!STREQ(SECURITY_SELINUX_NAME, secdef->model)) {
+    if (STRNEQ(SECURITY_SELINUX_NAME, secdef->model)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("security label driver mismatch: "
                          "'%s' model configured for domain, but "
@@ -2202,7 +2202,7 @@ virSecuritySELinuxSetSecuritySocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNU
     if (!secdef || !secdef->label)
         return 0;
 
-    if (!STREQ(SECURITY_SELINUX_NAME, secdef->model)) {
+    if (STRNEQ(SECURITY_SELINUX_NAME, secdef->model)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("security label driver mismatch: "
                          "'%s' model configured for domain, but "
@@ -2240,7 +2240,7 @@ virSecuritySELinuxClearSecuritySocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_U
     if (!secdef || !secdef->label)
         return 0;
 
-    if (!STREQ(SECURITY_SELINUX_NAME, secdef->model)) {
+    if (STRNEQ(SECURITY_SELINUX_NAME, secdef->model)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("security label driver mismatch: "
                          "'%s' model configured for domain, but "
index f1321db42c0355e78ce007c34faddeff075339fa..536e617319d706b80ad0930909d8ecddbf4ab64d 100644 (file)
@@ -147,7 +147,7 @@ virStorageBackendLogicalMakeVol(char **const groups,
      * (lvs outputs "[$lvname_vorigin] for field "origin" if the
      *  lv is created with "--virtualsize").
      */
-    if (groups[1] && !STREQ(groups[1], "") && (groups[1][0] != '[')) {
+    if (groups[1] && STRNEQ(groups[1], "") && (groups[1][0] != '[')) {
         if (VIR_ALLOC(vol->target.backingStore) < 0)
             goto cleanup;
 
index cba00cb567cef4d27df9999844579db861c775bf..e5cf2c5e7c2375f7111a7908c2756851e4292474 100644 (file)
@@ -1008,7 +1008,7 @@ virFileStripSuffix(char *str, const char *suffix)
     if (len < suffixlen)
         return 0;
 
-    if (!STREQ(str + len - suffixlen, suffix))
+    if (STRNEQ(str + len - suffixlen, suffix))
         return 0;
 
     str[len-suffixlen] = '\0';
index 54c409d7f6de921a1465d00ce5f549131815fe16..1354b08b9e04c4be7a98af854d34effc34f63d77 100644 (file)
@@ -375,7 +375,7 @@ int virSystemdTerminateMachine(const char *name,
         goto cleanup;
 
     if (error.code == VIR_ERR_ERROR &&
-        !STREQ_NULLABLE("org.freedesktop.machine1.NoSuchMachine",
+        STRNEQ_NULLABLE("org.freedesktop.machine1.NoSuchMachine",
                         error.str1)) {
         virReportErrorObject(&error);
         goto cleanup;
index f6bb696e62e40653c0a0061bf701e27b95bc27e4..6f1cbfbebf907085f672efae0d075f6bad0e6a8f 100644 (file)
@@ -300,7 +300,7 @@ vzConnectOpen(virConnectPtr conn,
         return VIR_DRV_OPEN_DECLINED;
 
     /* From this point on, the connection is for us. */
-    if (!STREQ_NULLABLE(conn->uri->path, "/system")) {
+    if (STRNEQ_NULLABLE(conn->uri->path, "/system")) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unexpected Virtuozzo URI path '%s', try vz:///system"),
                        conn->uri->path);
index c24477ca5a508299bb0f7b220a8bd68e08b631ab..89c9e89c7d92087f90d5ac5dcbd476145a721cdd 100644 (file)
@@ -2026,7 +2026,7 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
         }
     } else {
         if (def->os.nBootDevs != 0 ||
-            !STREQ_NULLABLE(def->os.init, "/sbin/init") ||
+            STRNEQ_NULLABLE(def->os.init, "/sbin/init") ||
             (def->os.initargv != NULL && def->os.initargv[0] != NULL)) {
 
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
index b81c0b7436443ff7a316fb0768254aceec0b0192..62ce930293279cb8722eff72cc82baff553cc6b2 100644 (file)
@@ -2552,7 +2552,7 @@ xenDaemonDomainSetAutostart(virConnectPtr conn,
     if (autonode) {
         const char *val = (autonode->u.s.car->kind == SEXPR_VALUE
                            ? autonode->u.s.car->u.value : NULL);
-        if (!val || (!STREQ(val, "ignore") && !STREQ(val, "start"))) {
+        if (!val || (STRNEQ(val, "ignore") && STRNEQ(val, "start"))) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            "%s", _("unexpected value from on_xend_start"));
             goto error;
index 033b0ebb0d9ea0a50ce6a96ff5a3fc3454a2d058..7fc9c9d24ffbe2fdbb3fdc4dd69c01ba6eefb8db 100644 (file)
@@ -2345,7 +2345,7 @@ xenFormatSxpr(virConnectPtr conn,
                     /* Only xend <= 3.0.2 wants cdrom config here */
                     if (xendConfigVersion != XEND_CONFIG_VERSION_3_0_2)
                         break;
-                    if (!STREQ(def->disks[i]->dst, "hdc") || !src)
+                    if (STRNEQ(def->disks[i]->dst, "hdc") || !src)
                         break;
 
                     virBufferEscapeSexpr(&buf, "(cdrom '%s')", src);
index f001a39718e2871c547eb2fe841b3b139fd72fe1..cf5f44a1646cdfeaa07d259e4885b7f70d4f392d 100644 (file)
@@ -516,7 +516,7 @@ static int test13(const void *unused ATTRIBUTE_UNUSED)
     virCommandFree(cmd);
     cmd = NULL;
 
-    if (!STREQ(outactual, outexpect)) {
+    if (STRNEQ(outactual, outexpect)) {
         virtTestDifference(stderr, outexpect, outactual);
         goto cleanup;
     }
@@ -580,15 +580,15 @@ static int test14(const void *unused ATTRIBUTE_UNUSED)
     if (!jointactual)
         goto cleanup;
 
-    if (!STREQ(outactual, outexpect)) {
+    if (STRNEQ(outactual, outexpect)) {
         virtTestDifference(stderr, outexpect, outactual);
         goto cleanup;
     }
-    if (!STREQ(erractual, errexpect)) {
+    if (STRNEQ(erractual, errexpect)) {
         virtTestDifference(stderr, errexpect, erractual);
         goto cleanup;
     }
-    if (!STREQ(jointactual, jointexpect)) {
+    if (STRNEQ(jointactual, jointexpect)) {
         virtTestDifference(stderr, jointexpect, jointactual);
         goto cleanup;
     }
@@ -666,7 +666,7 @@ static int test16(const void *unused ATTRIBUTE_UNUSED)
         goto cleanup;
     }
 
-    if (!STREQ(outactual, outexpect)) {
+    if (STRNEQ(outactual, outexpect)) {
         virtTestDifference(stderr, outexpect, outactual);
         goto cleanup;
     }
index 86660f4a6503a03bfa5669e69601b609060f8e6f..c82b3f21a948e6c4f64b0542730be47c86e76571 100644 (file)
@@ -282,7 +282,7 @@ testSELinuxCheckLabels(testSELinuxFile *files, size_t nfiles)
                 return -1;
             }
         }
-        if (!STREQ_NULLABLE(files[i].context, ctx)) {
+        if (STRNEQ_NULLABLE(files[i].context, ctx)) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            "File %s context '%s' did not match epected '%s'",
                            files[i].file, ctx, files[i].context);
index d9e05fd3fac88a05e2d121865fcfe478190ea3f9..4c380b9c866168e85d79e02953d33f4e9d8b913f 100644 (file)
@@ -60,7 +60,7 @@ static int testAuthLookup(const void *args)
 
     if (data->expect) {
         if (!actual ||
-            !STREQ(actual, data->expect)) {
+            STRNEQ(actual, data->expect)) {
             VIR_WARN("Expected value '%s' for '%s' '%s' '%s', but got '%s'",
                      data->expect, data->hostname,
                      data->service, data->credname,
index a6e9a382f5d5a53e8bc32fc8eb79646c0d3af34a..8e458d25971c5ec5cf5195450dc081168a10155b 100644 (file)
@@ -355,7 +355,7 @@ test6(const void *v ATTRIBUTE_UNUSED)
     if (!str)
         goto error;
 
-    if (!STREQ(str, ""))
+    if (STRNEQ(str, ""))
         goto error;
 
     VIR_FREE(str);
@@ -365,7 +365,7 @@ test6(const void *v ATTRIBUTE_UNUSED)
     if (!str)
         goto error;
 
-    if (!STREQ(str, "0"))
+    if (STRNEQ(str, "0"))
         goto error;
 
     VIR_FREE(str);
@@ -376,7 +376,7 @@ test6(const void *v ATTRIBUTE_UNUSED)
     if (!str)
         goto error;
 
-    if (!STREQ(str, "0,4-5"))
+    if (STRNEQ(str, "0,4-5"))
         goto error;
 
     VIR_FREE(str);
@@ -386,7 +386,7 @@ test6(const void *v ATTRIBUTE_UNUSED)
     if (!str)
         goto error;
 
-    if (!STREQ(str, "0,4-6"))
+    if (STRNEQ(str, "0,4-6"))
         goto error;
 
     VIR_FREE(str);
@@ -399,7 +399,7 @@ test6(const void *v ATTRIBUTE_UNUSED)
     if (!str)
         goto error;
 
-    if (!STREQ(str, "0,4-6,13-16"))
+    if (STRNEQ(str, "0,4-6,13-16"))
         goto error;
 
     VIR_FREE(str);
@@ -410,7 +410,7 @@ test6(const void *v ATTRIBUTE_UNUSED)
     if (!str)
         goto error;
 
-    if (!STREQ(str, "0,4-6,13-16,62-63"))
+    if (STRNEQ(str, "0,4-6,13-16,62-63"))
         goto error;
 
 
index 7a876406adef5e6d196c7dcad4e439ac29a171aa..731ecc4094e202c10aefeebb2b09879d0b1da45b 100644 (file)
@@ -662,7 +662,7 @@ static int testCgroupGetPercpuStats(const void *args ATTRIBUTE_UNUSED)
     }
 
     for (i = 0; i < EXPECTED_NCPUS; i++) {
-        if (!STREQ(params[i].field, VIR_DOMAIN_CPU_STATS_CPUTIME)) {
+        if (STRNEQ(params[i].field, VIR_DOMAIN_CPU_STATS_CPUTIME)) {
             fprintf(stderr,
                     "Wrong parameter name value from virCgroupGetPercpuStats at %zu (is: %s)\n",
                     i, params[i].field);
index c31d2aafa0e86c251102423a016d134d1c6047ba..3908fa810f1ca6f8a0b4d6bd47bfd396db029ccc 100644 (file)
@@ -70,17 +70,17 @@ static int testParse(const void *args ATTRIBUTE_UNUSED)
         VIR_DEBUG("Missing Value 'Foo.three'");
         goto cleanup;
     }
-    if (!STREQ(virKeyFileGetValueString(kf, "Foo", "one"),
+    if (STRNEQ(virKeyFileGetValueString(kf, "Foo", "one"),
                "The first entry is here")) {
         VIR_DEBUG("Wrong value for 'Foo.one'");
         goto cleanup;
     }
-    if (!STREQ(virKeyFileGetValueString(kf, "Foo", "two"),
+    if (STRNEQ(virKeyFileGetValueString(kf, "Foo", "two"),
                "The second entry")) {
         VIR_DEBUG("Wrong value for 'Foo.one'");
         goto cleanup;
     }
-    if (!STREQ(virKeyFileGetValueString(kf, "Foo", "three"),
+    if (STRNEQ(virKeyFileGetValueString(kf, "Foo", "three"),
                "The third entry")) {
         VIR_DEBUG("Wrong value for 'Foo.one'");
         goto cleanup;
@@ -94,7 +94,7 @@ static int testParse(const void *args ATTRIBUTE_UNUSED)
         VIR_DEBUG("Missing Value 'Bar.one'");
         goto cleanup;
     }
-    if (!STREQ(virKeyFileGetValueString(kf, "Bar", "one"),
+    if (STRNEQ(virKeyFileGetValueString(kf, "Bar", "one"),
                "The first entry in second group")) {
         VIR_DEBUG("Wrong value for 'Bar.one'");
         goto cleanup;
index 1ababad9c5f0a7075fa3579f26255e51157282c6..ce9eeabc9e52e852f7b83a06d151007afba9ae0a 100644 (file)
@@ -406,7 +406,7 @@ static int testSocketSSH(const void *opaque)
         }
         buf[rv] = '\0';
 
-        if (!STREQ(buf, data->expectOut)) {
+        if (STRNEQ(buf, data->expectOut)) {
             virtTestDifference(stderr, data->expectOut, buf);
             goto cleanup;
         }
index b7bd72f50b07a3450d4d15fdd4bdb467c74d4166..f4a57925e597de2d644e52764f3f9367e2d06683 100644 (file)
@@ -188,7 +188,7 @@ testTypedParamsGetStringList(const void *opaque ATTRIBUTE_UNUSED)
                 goto cleanup;
             continue;
         }
-        if (!STREQLEN(strings[i], "bar", 3))
+        if (STRNEQLEN(strings[i], "bar", 3))
             goto cleanup;
         if (strings[i][3] != l++)
             goto cleanup;
index 48b586568390118bd0c1a20c486427ed10ba4a0b..e58e353ce2efcc250c0ba1daad6e73003691f901 100644 (file)
@@ -58,13 +58,13 @@ static int testURIParse(const void *args)
     if (!(uri = virURIParse(data->uri)))
         goto cleanup;
 
-    if (!STREQ(uri->scheme, data->scheme)) {
+    if (STRNEQ(uri->scheme, data->scheme)) {
         VIR_DEBUG("Expected scheme '%s', actual '%s'",
                   data->scheme, uri->scheme);
         goto cleanup;
     }
 
-    if (!STREQ(uri->server, data->server)) {
+    if (STRNEQ(uri->server, data->server)) {
         VIR_DEBUG("Expected server '%s', actual '%s'",
                   data->server, uri->server);
         goto cleanup;
@@ -76,31 +76,31 @@ static int testURIParse(const void *args)
         goto cleanup;
     }
 
-    if (!STREQ_NULLABLE(uri->path, data->path)) {
+    if (STRNEQ_NULLABLE(uri->path, data->path)) {
         VIR_DEBUG("Expected path '%s', actual '%s'",
                   data->path, uri->path);
         goto cleanup;
     }
 
-    if (!STREQ_NULLABLE(uri->query, data->query)) {
+    if (STRNEQ_NULLABLE(uri->query, data->query)) {
         VIR_DEBUG("Expected query '%s', actual '%s'",
                   data->query, uri->query);
         goto cleanup;
     }
 
-    if (!STREQ_NULLABLE(uri->fragment, data->fragment)) {
+    if (STRNEQ_NULLABLE(uri->fragment, data->fragment)) {
         VIR_DEBUG("Expected fragment '%s', actual '%s'",
                   data->fragment, uri->fragment);
         goto cleanup;
     }
 
     for (i = 0; data->params && data->params[i].name && i < uri->paramsCount; i++) {
-        if (!STREQ_NULLABLE(data->params[i].name, uri->params[i].name)) {
+        if (STRNEQ_NULLABLE(data->params[i].name, uri->params[i].name)) {
             VIR_DEBUG("Expected param name %zu '%s', actual '%s'",
                       i, data->params[i].name, uri->params[i].name);
             goto cleanup;
         }
-        if (!STREQ_NULLABLE(data->params[i].value, uri->params[i].value)) {
+        if (STRNEQ_NULLABLE(data->params[i].value, uri->params[i].value)) {
             VIR_DEBUG("Expected param value %zu '%s', actual '%s'",
                       i, data->params[i].value, uri->params[i].value);
             goto cleanup;
@@ -123,7 +123,7 @@ static int testURIParse(const void *args)
     if (!(uristr = virURIFormat(uri)))
         goto cleanup;
 
-    if (!STREQ(uristr, data->uri_out)) {
+    if (STRNEQ(uristr, data->uri_out)) {
         VIR_DEBUG("URI did not roundtrip, expect '%s', actual '%s'",
                   data->uri_out, uristr);
         goto cleanup;