vppinfra: add defines for bihash add and delete 71/30971/2
authorPaul Atkins <patkins@graphiant.com>
Tue, 19 Jan 2021 15:22:23 +0000 (15:22 +0000)
committerDave Barach <openvpp@barachs.net>
Mon, 1 Feb 2021 17:20:32 +0000 (17:20 +0000)
When calling the bihash_add_del... functions some callers add a comment
beside the value to indicate this is the is_add param. Make the code
easier to read by adding defines for add and delete that the callers
can use instead of having to use 0 or 1.

Type: improvement
Signed-off-by: Paul Atkins <patkins@graphiant.com>
Change-Id: Iab5f7c8e8df12ac62fc7e726ca1798622dcdb42c

src/vppinfra/bihash_doc.h
src/vppinfra/bihash_template.h

index b4b6a4a..7c7e517 100644 (file)
@@ -112,7 +112,7 @@ void clib_bihash_free (clib_bihash * h);
 
     @param h - the bi-hash table to search
     @param add_v - the (key,value) pair to add
-    @param is_add - add=1, delete=0
+    @param is_add - add=1 (BIHASH_ADD), delete=0 (BIHASH_DEL)
     @returns 0 on success, < 0 on error
     @note This function will replace an existing (key,value) pair if the
     new key matches an existing key
index 4ab27aa..1ca0ae4 100644 (file)
@@ -334,6 +334,9 @@ static inline uword BV (clib_bihash_get_offset) (BVT (clib_bihash) * h,
   return vp - hp;
 }
 
+#define BIHASH_ADD 1
+#define BIHASH_DEL 0
+
 void BV (clib_bihash_init)
   (BVT (clib_bihash) * h, char *name, u32 nbuckets, uword memory_size);