From: Rafael Garcia-Suarez Date: Tue, 14 Dec 2004 16:22:42 +0000 (+0000) Subject: Fix for [perl #32491] h2xs incorrectly parses enums with implicit values X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=baf7177e9c0fbdad246294d1c5ccab2ffb2ea28e;p=p5sagit%2Fp5-mst-13.2.git Fix for [perl #32491] h2xs incorrectly parses enums with implicit values p4raw-id: //depot/perl@23652 --- diff --git a/utils/h2xs.PL b/utils/h2xs.PL index ceac64e..b973705 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}++; }