This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=40eccd5c044c874cf7fa5f8dc8e2c75379395d8a commit 40eccd5c044c874cf7fa5f8dc8e2c75379395d8a (HEAD -> master) Author: Guillem Jover <[email protected]> AuthorDate: Mon May 14 23:26:07 2018 +0200 scripts: Do not use stringy eval to define different sub implementations We can just assign an anonymous sub to the typeglob. --- debian/changelog | 3 +++ scripts/Dpkg/Gettext.pm | 58 +++++++++++++++++++---------------------- scripts/dpkg-mergechangelogs.pl | 10 +++---- 3 files changed, 34 insertions(+), 37 deletions(-) diff --git a/debian/changelog b/debian/changelog index 01585aef7..14a311e31 100644 --- a/debian/changelog +++ b/debian/changelog @@ -114,6 +114,9 @@ dpkg (1.19.1) UNRELEASED; urgency=medium - Document the Testsuite and Testsuite-Triggers fields in deb-src-control(5). Prompted by Mattia Rizzolo <[email protected]>. - Update git URLs for move away from alioth.debian.org. + * Code internals: + - Do not use stringy eval to define different sub implementations, + just assign an anonymous sub to the typeglob. * Build system: - Set distribution tarball format to ustar, instead of default v7 format. - Mark PO4A and POD2MAN as precious variables. diff --git a/scripts/Dpkg/Gettext.pm b/scripts/Dpkg/Gettext.pm index 2e3e5042e..33ef1c48d 100644 --- a/scripts/Dpkg/Gettext.pm +++ b/scripts/Dpkg/Gettext.pm @@ -118,41 +118,37 @@ BEGIN { $use_gettext = not $@; } if (not $use_gettext) { - eval q{ - sub g_ { - return shift; - } - sub textdomain { - } - sub ngettext { - my ($msgid, $msgid_plural, $n) = @_; - if ($n == 1) { - return $msgid; - } else { - return $msgid_plural; - } - } - sub C_ { - my ($msgctxt, $msgid) = @_; + *g_ = sub { + return shift; + }; + *textdomain = sub { + }; + *ngettext = sub { + my ($msgid, $msgid_plural, $n) = @_; + if ($n == 1) { return $msgid; + } else { + return $msgid_plural; } - sub P_ { - return ngettext(@_); - } + }; + *C_ = sub { + my ($msgctxt, $msgid) = @_; + return $msgid; + }; + *P_ = sub { + return ngettext(@_); }; } else { - eval q{ - sub g_ { - return dgettext($DEFAULT_TEXT_DOMAIN, shift); - } - sub C_ { - my ($msgctxt, $msgid) = @_; - return dgettext($DEFAULT_TEXT_DOMAIN, - $msgctxt . GETTEXT_CONTEXT_GLUE . $msgid); - } - sub P_ { - return dngettext($DEFAULT_TEXT_DOMAIN, @_); - } + *g_ = sub { + return dgettext($DEFAULT_TEXT_DOMAIN, shift); + }; + *C_ = sub { + my ($msgctxt, $msgid) = @_; + return dgettext($DEFAULT_TEXT_DOMAIN, + $msgctxt . GETTEXT_CONTEXT_GLUE . $msgid); + }; + *P_ = sub { + return dngettext($DEFAULT_TEXT_DOMAIN, @_); }; } } diff --git a/scripts/dpkg-mergechangelogs.pl b/scripts/dpkg-mergechangelogs.pl index 7fd11fc96..20b33dc75 100755 --- a/scripts/dpkg-mergechangelogs.pl +++ b/scripts/dpkg-mergechangelogs.pl @@ -43,12 +43,10 @@ BEGIN { use Algorithm::Merge qw(merge); }; if ($@) { - eval q{ - sub merge { - my ($o, $a, $b) = @_; - return @$a if join("\n", @$a) eq join("\n", @$b); - return get_conflict_block($a, $b); - } + *merge = sub { + my ($o, $a, $b) = @_; + return @$a if join("\n", @$a) eq join("\n", @$b); + return get_conflict_block($a, $b); }; } } -- Dpkg.Org's dpkg

