This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Errno parsing: Don't match hex numbers in parts of function names
authorSteve Hay <steve.m.hay@googlemail.com>
Wed, 24 Sep 2014 07:53:39 +0000 (08:53 +0100)
committerSteve Hay <steve.m.hay@googlemail.com>
Thu, 25 Sep 2014 07:29:36 +0000 (08:29 +0100)
This stops __stdcall being seen as a hex number and turned into __stdca.
Also include _ in the pattern to match function names so that that gets
skipped anyway.

ext/Errno/Errno_pm.PL

index 9faa743..1a75fcb 100644 (file)
@@ -246,8 +246,8 @@ sub write_errno_pm {
            next unless ($name, $expr) = /"(.*?)"\s*\[\s*\[\s*(.*?)\s*\]\s*\]/;
            next if $name eq $expr;
            $expr =~ s/\(?\(\s*[a-z_]\w*\s*\)\(?([^\)]+)\)?\)?/$1/i; # ((type)0xcafebabe) at alia
-           $expr =~ s/((?:0x)?[0-9a-fA-F]+)[luLU]+\b/$1/g; # 2147483647L et alia
-           next if $expr =~ m/^[a-zA-Z]+$/; # skip some Win32 functions
+           $expr =~ s/\b((?:0x)?[0-9a-f]+)[LU]+\b/$1/gi; # 2147483647L et alia
+           next if $expr =~ m/^[a-z_]+$/i; # skip function names
            if($expr =~ m/^0[xX]/) {
                $err{$name} = hex $expr;
            }