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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux