lkml.org 
[lkml]   [2007]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 08/19] scripts: Make cleanfile/cleanpatch warn about long lines

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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-06-04 18:11    [W:0.619 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site