X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Fhash.h;h=e4a65d21e65b00b93ee7c1f75a7585ef3dd65cd1;hb=8e7fdddd3;hp=36a700660448f7a621757648b50c917c99cc8835;hpb=ec11b13a21b2becc1d1bd746a04624d17b26583f;p=vpp.git diff --git a/src/vppinfra/hash.h b/src/vppinfra/hash.h index 36a70066044..e4a65d21e65 100644 --- a/src/vppinfra/hash.h +++ b/src/vppinfra/hash.h @@ -276,11 +276,11 @@ uword hash_bytes (void *v); /* Public inline function allocate and copy key to use in hash for pointer key */ always_inline void -hash_set_mem_alloc (uword ** h, void *key, uword v) +hash_set_mem_alloc (uword ** h, const void *key, uword v) { size_t ksz = hash_header (*h)->user; void *copy = clib_mem_alloc (ksz); - clib_memcpy (copy, key, ksz); + clib_memcpy_fast (copy, key, ksz); hash_set_mem (*h, copy, v); } @@ -292,14 +292,14 @@ hash_set_mem_alloc (uword ** h, void *key, uword v) /* Public inline function to unset pointer key and then free the key memory */ always_inline void -hash_unset_mem_free (uword ** h, void *key) +hash_unset_mem_free (uword ** h, const void *key) { hash_pair_t *hp = hash_get_pair_mem (*h, key); if (PREDICT_TRUE (hp != NULL)) { - key = uword_to_pointer (hp->key, void *); - hash_unset_mem (*h, key); - clib_mem_free (key); + void *_k = uword_to_pointer (hp->key, void *); + hash_unset_mem (*h, _k); + clib_mem_free (_k); } } @@ -496,7 +496,7 @@ hash_set_value_bytes (hash_t * h, uword value_bytes) _format_pair,_format_pair_arg) \ ({ \ hash_t _h; \ - memset (&_h, 0, sizeof (_h)); \ + clib_memset (&_h, 0, sizeof (_h)); \ _h.user = (_user); \ _h.key_sum = (hash_key_sum_function_t *) (_key_sum); \ _h.key_equal = (_key_equal); \