Skip to content

Commit

Permalink
New signature for static fcn my_langinfo()
Browse files Browse the repository at this point in the history
This commit changes the calling sequence for my_langinfo to add the
desired locale (or a sentinel to indicate to use the current locale),
and the locale category of the desired item.

This allows the function to be able to return the desired value for any
locale, avoiding some locale changes that would happen until this
commit, and hiding the need for locale changes from outside functions,
though a couple continue to do so to avoid potential multiple changes.
  • Loading branch information
khwilliamson committed May 9, 2021
1 parent bbe392d commit 74aa263
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 128 deletions.
10 changes: 6 additions & 4 deletions embed.fnc
Expand Up @@ -3220,13 +3220,15 @@ ST |unsigned int|get_category_index|const int category|NULLOK const char * local
S |const char*|switch_category_locale_to_template|const int switch_category|const int template_category|NULLOK const char * template_locale
S |void |restore_switched_locale|const int category|NULLOK const char * const original_locale
# if defined(HAS_NL_LANGINFO) || defined(HAS_NL_LANGINFO_L)
S |const char*|my_langinfo|const nl_item item \
|bool toggle \
S |const char*|my_langinfo_i|const nl_item item \
|const unsigned int cat_index \
|NULLOK const char * locale \
|NN const char ** retbufp \
|NULLOK Size_t * retbuf_sizep
# else
S |const char*|my_langinfo|const int item \
|bool toggle \
S |const char*|my_langinfo_i|const int item \
|const unsigned int cat_index \
|NULLOK const char * locale \
|NN const char ** retbufp \
|NULLOK Size_t * retbuf_sizep
# endif
Expand Down
4 changes: 2 additions & 2 deletions embed.h
Expand Up @@ -1505,7 +1505,7 @@
# if !(defined(HAS_NL_LANGINFO) || defined(HAS_NL_LANGINFO_L))
# if defined(PERL_IN_LOCALE_C)
# if defined(USE_LOCALE)
#define my_langinfo(a,b,c,d) S_my_langinfo(aTHX_ a,b,c,d)
#define my_langinfo_i(a,b,c,d,e) S_my_langinfo_i(aTHX_ a,b,c,d,e)
# endif
# endif
# endif
Expand Down Expand Up @@ -1615,7 +1615,7 @@
# if defined(HAS_NL_LANGINFO) || defined(HAS_NL_LANGINFO_L)
# if defined(PERL_IN_LOCALE_C)
# if defined(USE_LOCALE)
#define my_langinfo(a,b,c,d) S_my_langinfo(aTHX_ a,b,c,d)
#define my_langinfo_i(a,b,c,d,e) S_my_langinfo_i(aTHX_ a,b,c,d,e)
# endif
# endif
# endif
Expand Down

0 comments on commit 74aa263

Please sign in to comment.