Re: [PATCH 08/19] scripts: Make cleanfile/cleanpatch warn about longlines

From: Jan Engelhardt
Date: Mon Jun 04 2007 - 12:09:06 EST



On Jun 3 2007 22:47, Sam Ravnborg wrote:
>
>Make the "cleanfile" and "cleanpatch" script warn about long lines,
>by default lines whose visual width exceeds 79 characters.

Nice, nice. But, am I asking too much if tabs and kernel codestyle
could be used? (/me hides..., but see scripts/checkpatch.pl :-)

>+# Compute the visual width of a string
>+sub strwidth($) {
>+ no bytes; # Tab alignment depends on characters
>+
>+ my($li) = @_;
>+ my($c, $i);
>+ my $pos = 0;
>+ my $mlen = 0;
>+
>+ for ($i = 0; $i < length($li); $i++) {
>+ $c = substr($li,$i,1);
>+ if ($c eq "\t") {
>+ $pos = ($pos+8) & ~7;
>+ } elsif ($c eq "\n") {
>+ $mlen = $pos if ($pos > $mlen);
>+ $pos = 0;
>+ } else {
>+ $pos++;
>+ }
>+ }
>+
>+ $mlen = $pos if ($pos > $mlen);
>+ return $mlen;
>+}
>+


Jan
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/