All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libbpf: fix some typo of hashmap init
@ 2023-07-04  8:54 John Sanpe
  2023-07-04  9:26 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: John Sanpe @ 2023-07-04  8:54 UTC (permalink / raw)
  To: ast, daniel, andrii
  Cc: martin.lau, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, bpf, linux-kernel, John Sanpe

rename macro parameters to prevent replacing struct members of hashmap

Signed-off-by: John Sanpe <sanpeqf@gmail.com>
---
 tools/lib/bpf/hashmap.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
index 0a5bf1937a7c..bae3feaf29d0 100644
--- a/tools/lib/bpf/hashmap.h
+++ b/tools/lib/bpf/hashmap.h
@@ -80,14 +80,14 @@ struct hashmap {
 	size_t sz;
 };
 
-#define HASHMAP_INIT(hash_fn, equal_fn, ctx) {	\
-	.hash_fn = (hash_fn),			\
-	.equal_fn = (equal_fn),			\
-	.ctx = (ctx),				\
-	.buckets = NULL,			\
-	.cap = 0,				\
-	.cap_bits = 0,				\
-	.sz = 0,				\
+#define HASHMAP_INIT(_hash_fn, _equal_fn, _ctx) {	\
+	.hash_fn = (_hash_fn),				\
+	.equal_fn = (_equal_fn),			\
+	.ctx = (_ctx),					\
+	.buckets = NULL,				\
+	.cap = 0,					\
+	.cap_bits = 0,					\
+	.sz = 0,					\
 }
 
 void hashmap__init(struct hashmap *map, hashmap_hash_fn hash_fn,
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libbpf: fix some typo of hashmap init
  2023-07-04  8:54 [PATCH] libbpf: fix some typo of hashmap init John Sanpe
@ 2023-07-04  9:26 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2023-07-04  9:26 UTC (permalink / raw)
  To: John Sanpe, ast, andrii
  Cc: martin.lau, song, yhs, john.fastabend, kpsingh, sdf, haoluo,
	jolsa, bpf, linux-kernel

On 7/4/23 10:54 AM, John Sanpe wrote:
> rename macro parameters to prevent replacing struct members of hashmap
> 
> Signed-off-by: John Sanpe <sanpeqf@gmail.com>
> ---
>   tools/lib/bpf/hashmap.h | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
> index 0a5bf1937a7c..bae3feaf29d0 100644
> --- a/tools/lib/bpf/hashmap.h
> +++ b/tools/lib/bpf/hashmap.h
> @@ -80,14 +80,14 @@ struct hashmap {
>   	size_t sz;
>   };
>   
> -#define HASHMAP_INIT(hash_fn, equal_fn, ctx) {	\
> -	.hash_fn = (hash_fn),			\
> -	.equal_fn = (equal_fn),			\
> -	.ctx = (ctx),				\
> -	.buckets = NULL,			\
> -	.cap = 0,				\
> -	.cap_bits = 0,				\
> -	.sz = 0,				\
> +#define HASHMAP_INIT(_hash_fn, _equal_fn, _ctx) {	\
> +	.hash_fn = (_hash_fn),				\
> +	.equal_fn = (_equal_fn),			\
> +	.ctx = (_ctx),					\
> +	.buckets = NULL,				\
> +	.cap = 0,					\
> +	.cap_bits = 0,					\
> +	.sz = 0,					\
>   }
>   
>   void hashmap__init(struct hashmap *map, hashmap_hash_fn hash_fn,
> 

Please send a v2 and just remove the whole HASHMAP_INIT. It's not used
anywhere in libbpf.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-04  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04  8:54 [PATCH] libbpf: fix some typo of hashmap init John Sanpe
2023-07-04  9:26 ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.