lkml.org 
[lkml]   [2007]   [Jun]   [4]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateMon, 4 Jun 2007 18:07:10 +0200 (MEST)
FromJan Engelhardt <>
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 16:11    [from the cache]
©2003-2008