[libvirt] [PATCH 5/9] util: removed unused virIdentityIsEqual method

Daniel P. Berrangé berrange at redhat.com
Thu Sep 5 11:56:23 UTC 2019


It is simpler to remove this unused method than to rewrite it using
typed parameters in the next patch.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/libvirt_private.syms |  1 -
 src/util/viridentity.c   | 29 --------------------
 src/util/viridentity.h   |  6 ----
 tests/viridentitytest.c  | 59 ----------------------------------------
 4 files changed, 95 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 108a8ef736..fec1787497 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2153,7 +2153,6 @@ virIdentityGetUNIXGroupID;
 virIdentityGetUNIXUserID;
 virIdentityGetUserName;
 virIdentityGetX509DName;
-virIdentityIsEqual;
 virIdentityNew;
 virIdentitySetCurrent;
 virIdentitySetGroupName;
diff --git a/src/util/viridentity.c b/src/util/viridentity.c
index abb486c87f..55312fc0a0 100644
--- a/src/util/viridentity.c
+++ b/src/util/viridentity.c
@@ -297,35 +297,6 @@ virIdentityGetAttr(virIdentityPtr ident,
 }
 
 
-/**
- * virIdentityIsEqual:
- * @identA: the first identity
- * @identB: the second identity
- *
- * Compares every attribute in @identA and @identB
- * to determine if they refer to the same identity
- *
- * Returns true if they are equal, false if not equal
- */
-bool virIdentityIsEqual(virIdentityPtr identA,
-                        virIdentityPtr identB)
-{
-    bool ret = false;
-    size_t i;
-    VIR_DEBUG("identA=%p identB=%p", identA, identB);
-
-    for (i = 0; i < VIR_IDENTITY_ATTR_LAST; i++) {
-        if (STRNEQ_NULLABLE(identA->attrs[i],
-                            identB->attrs[i]))
-            goto cleanup;
-    }
-
-    ret = true;
- cleanup:
-    return ret;
-}
-
-
 int virIdentityGetUserName(virIdentityPtr ident,
                            const char **username)
 {
diff --git a/src/util/viridentity.h b/src/util/viridentity.h
index e243284cd5..805ad3ea4d 100644
--- a/src/util/viridentity.h
+++ b/src/util/viridentity.h
@@ -33,12 +33,6 @@ virIdentityPtr virIdentityGetSystem(void);
 
 virIdentityPtr virIdentityNew(void);
 
-
-bool virIdentityIsEqual(virIdentityPtr identA,
-                        virIdentityPtr identB)
-    ATTRIBUTE_NONNULL(1)
-    ATTRIBUTE_NONNULL(2);
-
 int virIdentityGetUserName(virIdentityPtr ident,
                            const char **username);
 int virIdentityGetUNIXUserID(virIdentityPtr ident,
diff --git a/tests/viridentitytest.c b/tests/viridentitytest.c
index cdf5325b4c..d76c779dd5 100644
--- a/tests/viridentitytest.c
+++ b/tests/viridentitytest.c
@@ -84,63 +84,6 @@ static int testIdentityAttrs(const void *data ATTRIBUTE_UNUSED)
 }
 
 
-static int testIdentityEqual(const void *data ATTRIBUTE_UNUSED)
-{
-    int ret = -1;
-    virIdentityPtr identa = NULL;
-    virIdentityPtr identb = NULL;
-
-    if (!(identa = virIdentityNew()))
-        goto cleanup;
-    if (!(identb = virIdentityNew()))
-        goto cleanup;
-
-    if (!virIdentityIsEqual(identa, identb)) {
-        VIR_DEBUG("Empty identities were not equal");
-        goto cleanup;
-    }
-
-    if (virIdentitySetUserName(identa, "fred") < 0)
-        goto cleanup;
-
-    if (virIdentityIsEqual(identa, identb)) {
-        VIR_DEBUG("Mis-matched identities should not be equal");
-        goto cleanup;
-    }
-
-    if (virIdentitySetUserName(identb, "fred") < 0)
-        goto cleanup;
-
-    if (!virIdentityIsEqual(identa, identb)) {
-        VIR_DEBUG("Matched identities were not equal");
-        goto cleanup;
-    }
-
-    if (virIdentitySetGroupName(identa, "flintstone") < 0)
-        goto cleanup;
-    if (virIdentitySetGroupName(identb, "flintstone") < 0)
-        goto cleanup;
-
-    if (!virIdentityIsEqual(identa, identb)) {
-        VIR_DEBUG("Matched identities were not equal");
-        goto cleanup;
-    }
-
-    if (virIdentitySetSASLUserName(identb, "fred at FLINTSTONE.COM") < 0)
-        goto cleanup;
-
-    if (virIdentityIsEqual(identa, identb)) {
-        VIR_DEBUG("Mis-matched identities should not be equal");
-        goto cleanup;
-    }
-
-    ret = 0;
- cleanup:
-    virObjectUnref(identa);
-    virObjectUnref(identb);
-    return ret;
-}
-
 static int testIdentityGetSystem(const void *data)
 {
     const char *context = data;
@@ -204,8 +147,6 @@ mymain(void)
 
     if (virTestRun("Identity attributes ", testIdentityAttrs, NULL) < 0)
         ret = -1;
-    if (virTestRun("Identity equality ", testIdentityEqual, NULL) < 0)
-        ret = -1;
     if (virTestRun("Setting fake SELinux context ", testSetFakeSELinuxContext, context) < 0)
         ret = -1;
     if (virTestRun("System identity (fake SELinux enabled) ", testIdentityGetSystem, context) < 0)
-- 
2.21.0




More information about the libvir-list mailing list