Skip to content

Commit

Permalink
locale.c: Omit an extra copy
Browse files Browse the repository at this point in the history
In this case in Perl_setlocale(), we can just return the plain result
from setlocale(), as, if something further needs to be done that would
destroy it, that is taken care of already at the time.

On per-thread locale platforms, the result already is in a per-category
buffer.
  • Loading branch information
khwilliamson committed May 6, 2021
1 parent c28bfa9 commit 12465ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locale.c
Expand Up @@ -2644,8 +2644,8 @@ Perl_setlocale(const int category, const char * locale)
}

/* Here, an actual change is being requested. Do it */
retval = save_to_buffer(setlocale_i(cat_index, locale),
&PL_setlocale_buf, &PL_setlocale_bufsize);
retval = setlocale_i(cat_index, locale);

if (! retval) {
DEBUG_L(PerlIO_printf(Perl_debug_log,
"Perl_setlocale returning (null)\n"));
Expand Down

0 comments on commit 12465ba

Please sign in to comment.