Re: Checkpatch being daft, Was: [PATCH -v2 08/10] m68k,mm: Extend table allocator for multiple sizes

From: Peter Zijlstra
Date: Mon Feb 10 2020 - 11:38:56 EST


On Sun, Feb 09, 2020 at 10:24:15AM -0800, Joe Perches wrote:
> Maybe this?

This isn't anywhere near RFC compliant, but I do think it greatly
improves the current situation, so:

Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>

one little nit below..

> ---
> scripts/checkpatch.pl | 39 +++++++++++++++++++++++++++++----------
> 1 file changed, 29 insertions(+), 10 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index f3b8434..17637d0 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1132,6 +1132,7 @@ sub parse_email {
> my ($formatted_email) = @_;
>
> my $name = "";
> + my $name_comment = "";
> my $address = "";
> my $comment = "";
>
> @@ -1164,6 +1165,10 @@ sub parse_email {
>
> $name = trim($name);
> $name =~ s/^\"|\"$//g;
> + $name =~ s/(\s*\([^\)]+\))\s*//;
> + if (defined($1)) {
> + $name_comment = trim($1);
> + }
> $address = trim($address);
> $address =~ s/^\<|\>$//g;
>
> @@ -1172,7 +1177,7 @@ sub parse_email {
> $name = "\"$name\"";
> }
>
> - return ($name, $address, $comment);
> + return ($name, $name_comment, $address, $comment);
> }
>
> sub format_email {
> @@ -1198,6 +1203,23 @@ sub format_email {
> return $formatted_email;
> }
>
> +sub reformat_email {
> + my ($email) = @_;
> +
> + my ($email_name, $name_comment, $email_address, $comment) = parse_email($email);
> + return format_email($email_name, $email_address);
> +}
> +
> +sub same_email_addresses {
> + my ($email1, $email2) = @_;
> +
> + my ($email1_name, $name1_comment, $email1_address, $comment1) = parse_email($email1);
> + my ($email2_name, $name2_comment, $email2_address, $comment2) = parse_email($email2);
> +
> + return $email1_name eq $email2_name &&
> + $email1_address eq $email2_address;

strictly speaking only _address needs be the same for the whole thing to
arrive at the same inbox, but I suppose that for sanity's sake, this
comparison makes sense.

> +}