diff options
author | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2005-09-26 17:50:31 +0000 |
---|---|---|
committer | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2005-09-26 17:50:31 +0000 |
commit | 743a9aa6de523c46c1d690dd004e53d6a3bd44a0 (patch) | |
tree | 5aae5699bb741833e2f913ecdfa0778cfd49313a | |
parent | c7a0fa04d4864df7066e8c8852450c982acae1c3 (diff) |
Allow empty macro arguments.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4152 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rwxr-xr-x | lib/sbin/cpp.pl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/sbin/cpp.pl b/lib/sbin/cpp.pl index 4cfccb65..375abad0 100755 --- a/lib/sbin/cpp.pl +++ b/lib/sbin/cpp.pl @@ -806,6 +806,13 @@ sub ExpandMacro my $retcode = 0; my @arguments = &SplitArgs($args); + # SplitArgs returns one (empty) argument for macros without arguments, + # because it cannot distinguish between no arguments and one empty argument. + if (@{$defines{$macro}{"ARGS"}} == 0) + { + @arguments = (); + } + my $outstring = $defines{$macro}{"BODY"}; if($macro eq "__FILE__") @@ -949,11 +956,8 @@ sub SplitArgs push(@thistoken, $splitargs[$pos]); } - # Push any remaining token - if(@thistoken > 0) - { - push(@outargs, join("",@thistoken)); - } + # Push the remaining token + push(@outargs, join("",@thistoken)); return @outargs; } |