This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Slight refactor
authorKarl Williamson <khw@cpan.org>
Tue, 12 Sep 2017 00:56:49 +0000 (18:56 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 9 Nov 2017 03:52:52 +0000 (20:52 -0700)
This makes savepv() part of the expressions instead of a separate
statement.

locale.c

index 99d42e0..d31db26 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -3490,14 +3490,12 @@ Perl_my_strerror(pTHX_ const int errnum)
     /* This function is trivial if we have strerror_l() */
 
     if (within_locale_scope) {
-        errstr = strerror(errnum);
+        errstr = savepv(strerror(errnum));
     }
     else {
-        errstr = strerror_l(errnum, PL_C_locale_obj);
+        errstr = savepv(strerror_l(errnum, PL_C_locale_obj));
     }
 
-    errstr = savepv(errstr);
-
 #  else /* Doesn't have strerror_l(). */
 
 #    ifdef USE_POSIX_2008_LOCALE