summaryrefslogtreecommitdiff
path: root/utils/h2xs.PL
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-12-14 16:22:42 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-12-14 16:22:42 +0000
commitbaf7177e9c0fbdad246294d1c5ccab2ffb2ea28e (patch)
treeccfc4dd565bb8fd8bf0702150a47fa9790540f65 /utils/h2xs.PL
parentdd3e1c90041b1d5e39a823b0e7f47196cd71ae46 (diff)
downloadperl-baf7177e9c0fbdad246294d1c5ccab2ffb2ea28e.tar.gz
Fix for [perl #32491] h2xs incorrectly parses enums with implicit values
p4raw-id: //depot/perl@23652
Diffstat (limited to 'utils/h2xs.PL')
-rw-r--r--utils/h2xs.PL4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/h2xs.PL b/utils/h2xs.PL
index ceac64ee31..b973705ed0 100644
--- a/utils/h2xs.PL
+++ b/utils/h2xs.PL
@@ -901,8 +901,8 @@ if( @path_h ){
next if $opt_e && $enum_name =~ /$opt_e/;
my $val = 0;
for my $item (split /,/, $enum_body) {
- my ($key, $declared_val) = $item =~ /(\w+)\s*=\s*(.*)/;
- $val = length($declared_val) ? $declared_val : 1 + $val;
+ my ($key, $declared_val) = $item =~ /(\w+)\s*(?:=\s*(.*))?/;
+ $val = defined($declared_val) && length($declared_val) ? $declared_val : 1 + $val;
$seen_define{$key} = $declared_val;
$const_names{$key}++;
}