diff options
author | Yves Orton <demerphq@gmail.com> | 2023-01-13 20:37:01 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-01-14 17:53:20 +0100 |
commit | cc8af69427466b91a81167e24e583e8638b32949 (patch) | |
tree | 5cc80e779f92c8c93a16a25f804c3564ef51b775 /regen | |
parent | 33019846eaa4ea3ee24c40e9765272bbc0f49317 (diff) | |
download | perl-cc8af69427466b91a81167e24e583e8638b32949.tar.gz |
embed.pl - add a way to declare a parameter should be non-zero
This autogenerates the required asserts to validate a parameter is non-zero.
It uses it to replace the check in regrepeat() as a first example.
Diffstat (limited to 'regen')
-rwxr-xr-x | regen/embed.pl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/regen/embed.pl b/regen/embed.pl index e23d756f05..885f7fbe4b 100755 --- a/regen/embed.pl +++ b/regen/embed.pl @@ -222,6 +222,7 @@ sub generate_proto_h { } my $nn = ( $arg =~ s/\s*\bNN\b\s+// ); push( @nonnull, $n ) if $nn; + my $nz = ( $arg =~ s/\s*\bNZ\b\s+// ); my $nullok = ( $arg =~ s/\s*\bNULLOK\b\s+// ); # strip NULLOK with no effect @@ -234,7 +235,7 @@ sub generate_proto_h { && ($temp_arg !~ /\w+\s+(\w+)(?:\[\d+\])?\s*$/) ) { die_at_end "$func: $arg ($n) doesn't have a name\n"; } - if (defined $1 && $nn && !($commented_out && !$binarycompat)) { + if (defined $1 && ($nn||$nz) && !($commented_out && !$binarycompat)) { push @names_of_nn, $1; } } |