Skip to content

Commit

Permalink
locale.c: Move copy from macro to called function
Browse files Browse the repository at this point in the history
Not all returns from the function need to be copied.  Thus this
eliminates some extraneous copies.
  • Loading branch information
khwilliamson committed May 6, 2023
1 parent 2f60250 commit 11de12e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions locale.c
Expand Up @@ -1200,7 +1200,7 @@ S_less_dicey_bool_setlocale_r(pTHX_ const int cat, const char * locale)
* are equivalents, like LC_NUMERIC_MASK, which we use instead, which we find
* by table lookup. */

# define querylocale_i(i) mortalized_pv_copy(querylocale_2008_i(i))
# define querylocale_i(i) querylocale_2008_i(i)
# define querylocale_c(cat) querylocale_i(cat##_INDEX_)
# define querylocale_r(cat) querylocale_i(get_category_index(cat))

Expand Down Expand Up @@ -1259,7 +1259,7 @@ S_querylocale_2008_i(pTHX_ const unsigned int index)
category_names[index], cur_obj));
if (cur_obj == LC_GLOBAL_LOCALE) {
POSIX_SETLOCALE_LOCK;
retval = posix_setlocale(category, NULL);
retval = mortalized_pv_copy(posix_setlocale(category, NULL));
POSIX_SETLOCALE_UNLOCK;
}
else {
Expand All @@ -1280,7 +1280,7 @@ S_querylocale_2008_i(pTHX_ const unsigned int index)
PL_curlocales[index] = savepv(stdized_setlocale(category, NULL));
}

retval = PL_curlocales[index];
retval = mortalized_pv_copy(PL_curlocales[index]);

# endif

Expand Down

0 comments on commit 11de12e

Please sign in to comment.