Skip to content

Commit

Permalink
locale.c: Rmv unnecessary savepv()
Browse files Browse the repository at this point in the history
This moves the savepv() down in the function, after we know we need it.
  • Loading branch information
khwilliamson committed May 6, 2021
1 parent 21bcbe5 commit 58d41f1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions locale.c
Expand Up @@ -1555,8 +1555,6 @@ S_set_numeric_radix(pTHX_ const bool use_locale)
STATIC void
S_new_numeric(pTHX_ const char *newnum)
{
const char *save_newnum;

PERL_ARGS_ASSERT_NEW_NUMERIC;

# ifndef USE_LOCALE_NUMERIC
Expand Down Expand Up @@ -1607,17 +1605,15 @@ S_new_numeric(pTHX_ const char *newnum)
* such platforms.
*/

save_newnum = savepv(newnum);
PL_numeric_underlying = TRUE;

/* Save the new name if it isn't the same as the previous one, if any */
if (PL_numeric_name && strEQ(PL_numeric_name, save_newnum)) {
Safefree(save_newnum);
if (PL_numeric_name && strEQ(PL_numeric_name, newnum)) {
}
else {
/* Save the locale name for future use */
Safefree(PL_numeric_name);
PL_numeric_name = save_newnum;
PL_numeric_name = savepv(newnum);
}

# ifdef USE_POSIX_2008_LOCALE
Expand Down

0 comments on commit 58d41f1

Please sign in to comment.