aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-04-17 17:27:31 -0400
committerDave Wallace <dwallacelf@gmail.com>2019-04-18 00:35:18 +0000
commitee66c8d3ca38c6e09e33584bee93f80b58cabc2b (patch)
tree9f897af22c93c739cb4bf692a57039e8fcf3bfa4 /src/vppinfra
parent11ee93f6abfaddf5bbd56cf0858c0c6ea0384b65 (diff)
Use template-specific key compare fn when deleting records
A simple memcmp won't work when comparing pointer-keys, such as those used by the bihash_vec8_8.h template. Change-Id: I77e59f3fd7f7740ef42908ace90ed4843e1c9ac7 Signed-off-by: Dave Barach <dave@barachs.net> (cherry picked from commit a11bf45b1aba14246cc1259fff1dfb8e9c60581f)
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/bihash_template.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c
index 6e910febce1..2840342a5ce 100644
--- a/src/vppinfra/bihash_template.c
+++ b/src/vppinfra/bihash_template.c
@@ -468,7 +468,7 @@ static inline int BV (clib_bihash_add_del_inline)
*/
for (i = 0; i < limit; i++)
{
- if (!memcmp (&(v->kvp[i]), &add_v->key, sizeof (add_v->key)))
+ if (BV (clib_bihash_key_compare) (v->kvp[i].key, add_v->key))
{
CLIB_MEMORY_BARRIER (); /* Add a delay */
clib_memcpy_fast (&(v->kvp[i]), add_v, sizeof (*add_v));
@@ -519,7 +519,7 @@ static inline int BV (clib_bihash_add_del_inline)
for (i = 0; i < limit; i++)
{
/* Found the key? Kill it... */
- if (!memcmp (&(v->kvp[i]), &add_v->key, sizeof (add_v->key)))
+ if (BV (clib_bihash_key_compare) (v->kvp[i].key, add_v->key))
{
clib_memset (&(v->kvp[i]), 0xff, sizeof (*(add_v)));
/* Is the bucket empty? */