[PATCH 02/15] util: virhash: Remove virHashTableSize

Peter Krempa pkrempa at redhat.com
Thu Oct 22 09:34:53 UTC 2020


It's used only in one place in tests which isn't even automatically
evaluated.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/libvirt_private.syms |  1 -
 src/util/virhash.c       | 17 -----------------
 src/util/virhash.h       |  1 -
 tests/virhashtest.c      |  6 ------
 4 files changed, 25 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b2d786409b..79c8403208 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2213,7 +2213,6 @@ virHashRemoveSet;
 virHashSearch;
 virHashSize;
 virHashSteal;
-virHashTableSize;
 virHashUpdateEntry;
 virHashValueFree;

diff --git a/src/util/virhash.c b/src/util/virhash.c
index 4b503a0313..7dd2d9f81d 100644
--- a/src/util/virhash.c
+++ b/src/util/virhash.c
@@ -549,23 +549,6 @@ virHashSize(const virHashTable *table)
     return table->nbElems;
 }

-/**
- * virHashTableSize:
- * @table: the hash table
- *
- * Query the size of the hash @table, i.e., number of buckets in the table.
- *
- * Returns the number of keys in the hash table or
- * -1 in case of error
- */
-ssize_t
-virHashTableSize(const virHashTable *table)
-{
-    if (table == NULL)
-        return -1;
-    return table->size;
-}
-

 /**
  * virHashRemoveEntry:
diff --git a/src/util/virhash.h b/src/util/virhash.h
index cb59fb639b..37853aba36 100644
--- a/src/util/virhash.h
+++ b/src/util/virhash.h
@@ -125,7 +125,6 @@ virHashTablePtr virHashCreateFull(ssize_t size,
                                   virHashKeyFree keyFree);
 void virHashFree(virHashTablePtr table);
 ssize_t virHashSize(const virHashTable *table);
-ssize_t virHashTableSize(const virHashTable *table);

 /*
  * Add a new entry to the hash table.
diff --git a/tests/virhashtest.c b/tests/virhashtest.c
index af30791241..7b1b8dd38c 100644
--- a/tests/virhashtest.c
+++ b/tests/virhashtest.c
@@ -27,16 +27,10 @@ testHashInit(int size)
      * collision list in the same order as in the uuids array
      */
     for (i = G_N_ELEMENTS(uuids) - 1; i >= 0; i--) {
-        ssize_t oldsize = virHashTableSize(hash);
         if (virHashAddEntry(hash, uuids[i], (void *) uuids[i]) < 0) {
             virHashFree(hash);
             return NULL;
         }
-
-        if (virHashTableSize(hash) != oldsize) {
-            VIR_TEST_DEBUG("hash grown from %zu to %zu",
-                     (size_t)oldsize, (size_t)virHashTableSize(hash));
-        }
     }

     for (i = 0; i < G_N_ELEMENTS(uuids); i++) {
-- 
2.26.2




More information about the libvir-list mailing list