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 Apr 23, 2021
1 parent 13cc0ed commit a96bb8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locale.c
Original file line number Diff line number Diff line change
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 a96bb8b

Please sign in to comment.