Skip to content

Commit

Permalink
XXX critical section examine thisvutil.c: Use Perl_setlocale not setl…
Browse files Browse the repository at this point in the history
…ocale

The direct libc call is not to be used directly by XS code.  Instead,
the plug-in replacement Perl_setlocale is the proper XXX.
  • Loading branch information
khwilliamson committed May 6, 2023
1 parent a54b412 commit bac344f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,13 +640,13 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)

LC_NUMERIC_LOCK(0); /* Start critical section */

locale_name_on_entry = setlocale(LC_NUMERIC, NULL);
locale_name_on_entry = Perl_setlocale(LC_NUMERIC, NULL);
if ( strNE(locale_name_on_entry, "C")
&& strNE(locale_name_on_entry, "POSIX"))
{
/* the setlocale() call might free or overwrite the name */
locale_name_on_entry = savepv(locale_name_on_entry);
setlocale(LC_NUMERIC, "C");
Perl_setlocale(LC_NUMERIC, "C");
}
else { /* This value indicates to the restore code that we didn't
change the locale */
Expand All @@ -673,7 +673,7 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)
# ifndef USE_POSIX_2008_LOCALE

if (locale_name_on_entry) {
setlocale(LC_NUMERIC, locale_name_on_entry);
Perl_setlocale(LC_NUMERIC, locale_name_on_entry);
Safefree(locale_name_on_entry);
}

Expand Down

0 comments on commit bac344f

Please sign in to comment.