diff mbox series

metadata: Ignore system macros

Message ID 20211105140425.8272-1-chrubis@suse.cz
State Accepted
Headers show
Series metadata: Ignore system macros | expand

Commit Message

Cyril Hrubis Nov. 5, 2021, 2:04 p.m. UTC
Ingore all macros that start with underscore. Unless we do that we get
several thousands of __NR_foo macros and the hash table cannot keep up.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 metadata/metaparse.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Petr Vorel Nov. 5, 2021, 2:11 p.m. UTC | #1
Hi Cyril,

> Ingore all macros that start with underscore. Unless we do that we get
> several thousands of __NR_foo macros and the hash table cannot keep up.

> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Good catch. Suppose skipping many tests does not need print info under verbose.

Kind regards,
Petr
Richard Palethorpe Nov. 5, 2021, 2:24 p.m. UTC | #2
Hello,

Cyril Hrubis <chrubis@suse.cz> writes:

> Ingore all macros that start with underscore. Unless we do that we get
> several thousands of __NR_foo macros and the hash table cannot keep up.
>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>

Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>

> ---
>  metadata/metaparse.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/metadata/metaparse.c b/metadata/metaparse.c
> index b38550550..f71d8628d 100644
> --- a/metadata/metaparse.c
> +++ b/metadata/metaparse.c
> @@ -624,6 +624,9 @@ static void parse_macro(FILE *f)
>  
>  	macro_get_val(f, val, sizeof(val));
>  
> +	if (name[0] == '_')
> +		return;
> +
>  	ENTRY e = {
>  		.key = strdup(name),
>  		.data = strdup(val),
> -- 
> 2.32.0
Cyril Hrubis Nov. 5, 2021, 2:28 p.m. UTC | #3
Hi!
Thank you both for the quick review, pushed.
diff mbox series

Patch

diff --git a/metadata/metaparse.c b/metadata/metaparse.c
index b38550550..f71d8628d 100644
--- a/metadata/metaparse.c
+++ b/metadata/metaparse.c
@@ -624,6 +624,9 @@  static void parse_macro(FILE *f)
 
 	macro_get_val(f, val, sizeof(val));
 
+	if (name[0] == '_')
+		return;
+
 	ENTRY e = {
 		.key = strdup(name),
 		.data = strdup(val),