[PATCH v2 01/14] devtools: fix forbidden token check with multiple files

Thomas Monjalon thomas at monjalon.net
Thu Sep 12 15:54:29 CEST 2024


12/09/2024 10:26, David Marchand:
> --- a/devtools/check-forbidden-tokens.awk
> +++ b/devtools/check-forbidden-tokens.awk
> @@ -32,14 +32,11 @@ BEGIN {
>  		for (i in deny_expr) {
>  			forbidden_added = "^\\+.*" deny_expr[i];
>  			forbidden_removed="^-.*" deny_expr[i];
> -			current = expressions[deny_expr[i]]
>  			if ($0 ~ forbidden_added) {
> -				count = count + 1;
> -				expressions[deny_expr[i]] = current + 1
> +				count = count + 1
>  			}
>  			if ($0 ~ forbidden_removed) {
> -				count = count - 1;
> -				expressions[deny_expr[i]] = current - 1
> +				count = count - 1
>  			}
>  		}
>  	}
> @@ -55,6 +52,7 @@ BEGIN {


While at it, you could insert a missing space in "previous filehad new additions"
few lines above.

>  	if (count > 0) {
>  		exit;
>  	}
> +	count = 0

I'm not an awk expert, but it looks simple enough.
Thank you

Acked-by: Thomas Monjalon <thomas at monjalon.net>




More information about the dev mailing list