vppinfra: Function to check if a bihash has been initialised 52/29152/2
authorNeale Ranns <nranns@cisco.com>
Tue, 29 Sep 2020 14:44:23 +0000 (14:44 +0000)
committerDamjan Marion <dmarion@me.com>
Fri, 2 Oct 2020 10:43:14 +0000 (10:43 +0000)
Type: improvement

Signed-off-by: Neale Ranns <nranns@cisco.com>
Change-Id: Ic31f7721f326ca9d78d645abcea63ce58df5bd5b

src/vppinfra/bihash_template.c
src/vppinfra/bihash_template.h

index 561855a..555c2e0 100644 (file)
@@ -390,6 +390,11 @@ void BV (clib_bihash_set_kvp_format_fn) (BVT (clib_bihash) * h,
   h->kvp_fmt_fn = kvp_fmt_fn;
 }
 
+int BV (clib_bihash_is_initialised) (const BVT (clib_bihash) * h)
+{
+  return (h->instantiated != 0);
+}
+
 void BV (clib_bihash_free) (BVT (clib_bihash) * h)
 {
   int i;
index 83c9427..4ab27aa 100644 (file)
@@ -363,6 +363,8 @@ int BV (clib_bihash_search) (BVT (clib_bihash) * h,
                             BVT (clib_bihash_kv) * search_v,
                             BVT (clib_bihash_kv) * return_v);
 
+int BV (clib_bihash_is_initialised) (const BVT (clib_bihash) * h);
+
 #define BIHASH_WALK_STOP 0
 #define BIHASH_WALK_CONTINUE 1