summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-04-17 17:27:31 -0400
committerDave Barach <dave@barachs.net>2019-04-17 17:28:37 -0400
commita11bf45b1aba14246cc1259fff1dfb8e9c60581f (patch)
treea078ed668fc03f2a141ff46bdb9818750bd23fa6 /src/vppinfra
parent402377e80c19b103792a0f340d9376e0138abbfe (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>
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? */