Skip to content

Commit

Permalink
locale.c: Rename S_calculate_LC_ALL_string()
Browse files Browse the repository at this point in the history
Its return is a string.  Add the suffix '_string' to emphasize that
  • Loading branch information
khwilliamson committed May 6, 2023
1 parent 10475d0 commit da66e62
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions embed.fnc
Expand Up @@ -4420,7 +4420,7 @@ S |const char *|setlocale_from_aggregate_LC_ALL \
|const line_t line
S |locale_t|use_curlocale_scratch
# if defined(USE_QUERYLOCALE)
S |const char *|calculate_LC_ALL \
S |const char *|calculate_LC_ALL_string \
|const locale_t cur_obj
# else
S |const char *|update_PL_curlocales_i \
Expand Down Expand Up @@ -4449,7 +4449,7 @@ S |bool |less_dicey_bool_setlocale_r \
# if !( defined(USE_POSIX_2008_LOCALE) && defined(USE_QUERYLOCALE) ) && \
( !defined(LC_ALL) || defined(USE_POSIX_2008_LOCALE) || \
defined(WIN32) )
S |const char *|calculate_LC_ALL \
S |const char *|calculate_LC_ALL_string \
|NN const char **individ_locales
# endif
# if defined(WIN32)
Expand Down
4 changes: 2 additions & 2 deletions embed.h
Expand Up @@ -1306,7 +1306,7 @@
# define setlocale_from_aggregate_LC_ALL(a,b) S_setlocale_from_aggregate_LC_ALL(aTHX_ a,b)
# define use_curlocale_scratch() S_use_curlocale_scratch(aTHX)
# if defined(USE_QUERYLOCALE)
# define calculate_LC_ALL(a) S_calculate_LC_ALL(aTHX_ a)
# define calculate_LC_ALL_string(a) S_calculate_LC_ALL_string(aTHX_ a)
# else
# define update_PL_curlocales_i(a,b,c) S_update_PL_curlocales_i(aTHX_ a,b,c)
# endif
Expand All @@ -1323,7 +1323,7 @@
# if !( defined(USE_POSIX_2008_LOCALE) && defined(USE_QUERYLOCALE) ) && \
( !defined(LC_ALL) || defined(USE_POSIX_2008_LOCALE) || \
defined(WIN32) )
# define calculate_LC_ALL(a) S_calculate_LC_ALL(aTHX_ a)
# define calculate_LC_ALL_string(a) S_calculate_LC_ALL_string(aTHX_ a)
# endif
# if defined(WIN32)
# define Win_byte_string_to_wstring S_Win_byte_string_to_wstring
Expand Down
22 changes: 11 additions & 11 deletions locale.c
Expand Up @@ -872,7 +872,7 @@ S_my_querylocale_i(pTHX_ const unsigned int index)
/* We don't currently keep records when there is querylocale(), so have
* to get it anew each time */
retval = (index == LC_ALL_INDEX_)
? calculate_LC_ALL(cur_obj)
? calculate_LC_ALL_string(cur_obj)
: querylocale_l(index, cur_obj);

# else
Expand Down Expand Up @@ -928,7 +928,7 @@ S_update_PL_curlocales_i(pTHX_
}

Safefree(PL_cur_LC_ALL);
PL_cur_LC_ALL = savepv(calculate_LC_ALL(PL_curlocales));
PL_cur_LC_ALL = savepv(calculate_LC_ALL_string(PL_curlocales));
return PL_cur_LC_ALL;
}

Expand All @@ -943,7 +943,7 @@ S_update_PL_curlocales_i(pTHX_
&& index == LC_ALL_INDEX_ - 1))
{
Safefree(PL_cur_LC_ALL);
PL_cur_LC_ALL = savepv(calculate_LC_ALL(PL_curlocales));
PL_cur_LC_ALL = savepv(calculate_LC_ALL_string(PL_curlocales));
}

return PL_curlocales[index];
Expand Down Expand Up @@ -1076,7 +1076,7 @@ S_setlocale_from_aggregate_LC_ALL(pTHX_ const char * locale, const line_t line)
* as well. We can't just use the input 'locale' as the value may omit
* categories whose locale is 'C'. khw thinks it's better to store a
* complete LC_ALL. So calculate it. */
const char * retval = savepv(calculate_LC_ALL(PL_curlocales));
const char * retval = savepv(calculate_LC_ALL_string(PL_curlocales));
Safefree(PL_cur_LC_ALL);
PL_cur_LC_ALL = retval;

Expand Down Expand Up @@ -1178,7 +1178,7 @@ S_emulate_setlocale_i(pTHX_
&& index == LC_ALL_INDEX_ - 1))
{
Safefree(PL_cur_LC_ALL);
PL_cur_LC_ALL = savepv(calculate_LC_ALL(PL_curlocales));
PL_cur_LC_ALL = savepv(calculate_LC_ALL_string(PL_curlocales));
}

# endif
Expand Down Expand Up @@ -1650,7 +1650,7 @@ S_find_locale_from_environment(pTHX_ const unsigned int index)
i, category_names[i], locale_names[i]));
}

return calculate_LC_ALL(locale_names);
return calculate_LC_ALL_string(locale_names);
}

#endif
Expand All @@ -1660,9 +1660,9 @@ STATIC
const char *

# ifdef USE_QUERYLOCALE
S_calculate_LC_ALL(pTHX_ const locale_t cur_obj)
S_calculate_LC_ALL_string(pTHX_ const locale_t cur_obj)
# else
S_calculate_LC_ALL(pTHX_ const char ** individ_locales)
S_calculate_LC_ALL_string(pTHX_ const char ** individ_locales)
# endif

{
Expand Down Expand Up @@ -1713,7 +1713,7 @@ S_calculate_LC_ALL(pTHX_ const char ** individ_locales)
char * this_start = NULL;
Size_t entry_len = 0;

PERL_ARGS_ASSERT_CALCULATE_LC_ALL;
PERL_ARGS_ASSERT_CALCULATE_LC_ALL_STRING;

/* First calculate the needed size for the string listing the categories
* and their locales. */
Expand Down Expand Up @@ -1779,7 +1779,7 @@ S_calculate_LC_ALL(pTHX_ const char ** individ_locales)
}

DEBUG_Lv(PerlIO_printf(Perl_debug_log,
"calculate_LC_ALL returning '%s'\n",
"calculate_LC_ALL_string returning '%s'\n",
aggregate_locale));

return aggregate_locale;
Expand All @@ -1805,7 +1805,7 @@ S_get_LC_ALL_display(pTHX)
curlocales[i] = querylocale_i(i);
}

return calculate_LC_ALL(curlocales);
return calculate_LC_ALL_string(curlocales);

# endif

Expand Down
8 changes: 4 additions & 4 deletions proto.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit da66e62

Please sign in to comment.