Skip to content

Commit f62b11d

Browse files
khwilliamsonLeont
authored andcommitted
vutil.c: Reverse order of conditionals, and add one
We know that C.UTF-8 also has a dot radix. And the reversed order is easier to understand.
1 parent 7c2467c commit f62b11d

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

vutil/vutil.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -685,17 +685,20 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)
685685
POSIX_SETLOCALE_LOCK; /* Start critical section */
686686

687687
locale_name_on_entry = setlocale(LC_NUMERIC, NULL);
688-
if ( strNE(locale_name_on_entry, "C")
689-
&& strNE(locale_name_on_entry, "POSIX"))
688+
if ( strEQ(locale_name_on_entry, "C")
689+
|| strEQ(locale_name_on_entry, "C.UTF-8")
690+
|| strEQ(locale_name_on_entry, "POSIX"))
690691
{
691-
/* the setlocale() call might free or overwrite the name */
692+
/* No need to change the locale, since these all are known to
693+
* have a dot radix. Change the variable to indicate to the
694+
* restore code that nothing needs to be done */
695+
locale_name_on_entry = NULL;
696+
}
697+
else {
698+
/* The setlocale() call might free or overwrite the name */
692699
locale_name_on_entry = savepv(locale_name_on_entry);
693700
setlocale(LC_NUMERIC, "C");
694701
}
695-
else { /* This value indicates to the restore code that we didn't
696-
change the locale */
697-
locale_name_on_entry = NULL;
698-
}
699702

700703
GET_NUMERIC_VERSION(ver, sv, tbuf, buf, len);
701704

0 commit comments

Comments
 (0)