summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-03-26 20:59:17 -0600
committerKarl Williamson <khw@cpan.org>2022-06-19 13:29:35 -0600
commit54ddc3dd881af3e418db218de9030d173f7bfbe6 (patch)
tree9ef9f6ef6a89a355d9241440f39b6de8ac9880e7
parentfe1c14942b81da8e421933b78e87d61c3cfbaafb (diff)
downloadperl-54ddc3dd881af3e418db218de9030d173f7bfbe6.tar.gz
locale.c: Move fcn within file
This is for later commits which will change it to rely on new defines that won't occur until later in the file than its current position
-rw-r--r--locale.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/locale.c b/locale.c
index 8a4b28800b..8634148c13 100644
--- a/locale.c
+++ b/locale.c
@@ -169,48 +169,6 @@ STATIC_ASSERT_DECL(STRLENs(UTF8NESS_PREFIX) == 1);
locale, result)
# endif
-STATIC char *
-S_stdize_locale(pTHX_ char *locs)
-{
- /* Standardize the locale name from a string returned by 'setlocale',
- * possibly modifying that string.
- *
- * The typical return value of setlocale() is either
- * (1) "xx_YY" if the first argument of setlocale() is not LC_ALL
- * (2) "xa_YY xb_YY ..." if the first argument of setlocale() is LC_ALL
- * (the space-separated values represent the various sublocales,
- * in some unspecified order). This is not handled by this function.
- *
- * In some platforms it has a form like "LC_SOMETHING=Lang_Country.866\n",
- * which is harmful for further use of the string in setlocale(). This
- * function removes the trailing new line and everything up through the '='
- * */
-
- const char * const s = strchr(locs, '=');
- bool okay = TRUE;
-
- PERL_ARGS_ASSERT_STDIZE_LOCALE;
-
- if (s) {
- const char * const t = strchr(s, '.');
- okay = FALSE;
- if (t) {
- const char * const u = strchr(t, '\n');
- if (u && (u[1] == 0)) {
- const STRLEN len = u - s;
- Move(s + 1, locs, len, char);
- locs[len] = 0;
- okay = TRUE;
- }
- }
- }
-
- if (!okay)
- Perl_croak(aTHX_ "Can't fix broken locale name \"%s\"", locs);
-
- return locs;
-}
-
/* Two parallel arrays indexed by our mapping of category numbers into small
* non-negative indexes; first the locale categories Perl uses on this system,
* used to do the inverse mapping. The second array is their names. These
@@ -1105,6 +1063,48 @@ S_emulate_setlocale_i(pTHX_ const unsigned int index, const char * locale)
#ifdef USE_LOCALE
+STATIC char *
+S_stdize_locale(pTHX_ char *locs)
+{
+ /* Standardize the locale name from a string returned by 'setlocale',
+ * possibly modifying that string.
+ *
+ * The typical return value of setlocale() is either
+ * (1) "xx_YY" if the first argument of setlocale() is not LC_ALL
+ * (2) "xa_YY xb_YY ..." if the first argument of setlocale() is LC_ALL
+ * (the space-separated values represent the various sublocales,
+ * in some unspecified order). This is not handled by this function.
+ *
+ * In some platforms it has a form like "LC_SOMETHING=Lang_Country.866\n",
+ * which is harmful for further use of the string in setlocale(). This
+ * function removes the trailing new line and everything up through the '='
+ * */
+
+ const char * const s = strchr(locs, '=');
+ bool okay = TRUE;
+
+ PERL_ARGS_ASSERT_STDIZE_LOCALE;
+
+ if (s) {
+ const char * const t = strchr(s, '.');
+ okay = FALSE;
+ if (t) {
+ const char * const u = strchr(t, '\n');
+ if (u && (u[1] == 0)) {
+ const STRLEN len = u - s;
+ Move(s + 1, locs, len, char);
+ locs[len] = 0;
+ okay = TRUE;
+ }
+ }
+ }
+
+ if (!okay)
+ Perl_croak(aTHX_ "Can't fix broken locale name \"%s\"", locs);
+
+ return locs;
+}
+
STATIC void
S_set_numeric_radix(pTHX_ const bool use_locale)
{