On Apr 6 2007 11:47, Randy Dunlap wrote:
>
>Unfortunately, kernel-doc has problems with a struct field like this:
> uint8_t databuf[NAND_MAX_PAGESIZE + NAND_MAX_OOBSIZE];
>
>simply due to the spaces around the "+" sign, so drop all spaces inside
>[...] so that parsing is done correctly (in some sense).
>
>@@ -1452,6 +1452,12 @@ sub create_parameterlist($$$) {
> $arg =~ s/\s*:\s*/:/g;
> $arg =~ s/\s*\[/\[/g;
>
>+ # no spaces inside [array size expression];
>+ # messes up split/pop/shift/unshift below;
>+ while ($arg =~ m/\[.*\s.*\]/) {
>+ $arg =~ s/\[(.*)\s(.*)\]/\[$1$2\]/;
>+ }
>+
> my @args = split('\s*,\s*', $arg);
> if ($args[0] =~ m/\*/) {
> $args[0] =~ s/(\*+)\s*/ $1/;
while($arg =~ s/\[(.*)\s+(.*)\]/[$1$2]/) {
}
should do it, and saves us the pre-matching. (Also note the + at \s)
(No need to escape [ and ] in the target pattern.)
I can also offer this gem which should do it the most saving way by
matching the inside of [] exactly once, and otherwise
matching/replacing only on \s:
$arg =~ s{\[(.*)\]}{($_=$1)=~s/\s+//g;"[$_]"}e;
(I already hear everyone screaming... ;-)
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]