From 279dbce0a7a1c420b00414b6ddd2a942a5e63572 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 3 Mar 2021 06:43:57 -0700 Subject: [PATCH] locale.c: Omit an extra copy 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. --- locale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale.c b/locale.c index 9f6d3ff2c10b..f08e843978d4 100644 --- a/locale.c +++ b/locale.c @@ -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"));