From: Konstantin Kharlamov Date: Sat, 6 Jul 2019 14:59:49 +0000 (-0700) Subject: Replace manually crafted hex regexes with [:xdigit:] X-Git-Tag: v1.0~4771 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=32a64c67192c9d9a892a9f52473cc402d7e9c135;p=gnulib.git Replace manually crafted hex regexes with [:xdigit:] * build-aux/gitlog-to-changelog (parse_amend_file) (git_dir_option): Replace various combinations of [0-9a-fA-F] with [[:xdigit:]]. This patch is backported from Emacs (Bug#36167). --- diff --git a/ChangeLog b/ChangeLog index bce8791014..885907d5c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2019-07-06 Konstantin Kharlamov + + Replace manually crafted hex regexes with [:xdigit:] + * build-aux/gitlog-to-changelog (parse_amend_file) + (git_dir_option): + Replace various combinations of [0-9a-fA-F] with [[:xdigit:]]. + This patch is backported from Emacs (Bug#36167). + 2019-07-06 Bruno Haible error: Fix documentation. diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index 3acfa8b4c5..163c48c8e2 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -189,7 +189,7 @@ sub parse_amend_file($) if (!$in_code) { - $line =~ /^([0-9a-fA-F]{40})$/ + $line =~ /^([[:xdigit:]]{40})$/ or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"), $fail = 1, next; $sha = lc $1; @@ -303,7 +303,7 @@ sub git_dir_option($) my ($sha, $rest) = split ':', $log, 2; defined $sha or die "$ME:$.: malformed log entry\n"; - $sha =~ /^[0-9a-fA-F]{40}$/ + $sha =~ /^[[:xdigit:]]{40}$/ or die "$ME:$.: invalid SHA1: $sha\n"; my $skipflag = 0; @@ -391,7 +391,7 @@ sub git_dir_option($) @skipshas = (); next; } - if ($found && $_ =~ /^([0-9a-fA-F]{7,}) [^ ]/) + if ($found && $_ =~ /^([[:xdigit:]]{7,}) [^ ]/) { push ( @skipshas, $1 ); }