Upgrade to Pod-Simple-3.04
[p5sagit/p5-mst-13.2.git] / locale.c
index e7572cf..55da8b1 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -1,7 +1,7 @@
 /*    locale.c
  *
  *    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- *    2000, 2001, 2002, 2003, 2005, by Larry Wall and others
+ *    2000, 2001, 2002, 2003, 2005, 2006, by Larry Wall and others
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -81,6 +81,7 @@ void
 Perl_set_numeric_radix(pTHX)
 {
 #ifdef USE_LOCALE_NUMERIC
+    dVAR;
 # ifdef HAS_LOCALECONV
     const struct lconv* const lc = localeconv();
 
@@ -109,6 +110,7 @@ void
 Perl_new_numeric(pTHX_ const char *newnum)
 {
 #ifdef USE_LOCALE_NUMERIC
+    dVAR;
 
     if (! newnum) {
        Safefree(PL_numeric_name);
@@ -134,6 +136,7 @@ void
 Perl_set_numeric_standard(pTHX)
 {
 #ifdef USE_LOCALE_NUMERIC
+    dVAR;
 
     if (! PL_numeric_standard) {
        setlocale(LC_NUMERIC, "C");
@@ -149,6 +152,7 @@ void
 Perl_set_numeric_local(pTHX)
 {
 #ifdef USE_LOCALE_NUMERIC
+    dVAR;
 
     if (! PL_numeric_local) {
        setlocale(LC_NUMERIC, PL_numeric_name);
@@ -190,6 +194,7 @@ void
 Perl_new_collate(pTHX_ const char *newcoll)
 {
 #ifdef USE_LOCALE_COLLATE
+    dVAR;
 
     if (! newcoll) {
        if (PL_collation_name) {
@@ -242,6 +247,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
      */
 
 #if defined(USE_LOCALE)
+    dVAR;
 
 #ifdef USE_LOCALE_CTYPE
     char *curctype   = NULL;
@@ -337,7 +343,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
 
     if (setlocale_failure) {
        char *p;
-       bool locwarn = (printwarn > 1 ||
+       const bool locwarn = (printwarn > 1 ||
                        (printwarn &&
                         (!(p = PerlEnv_getenv("PERL_BADLANG")) || atoi(p))));
 
@@ -499,23 +505,23 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
         codeset = nl_langinfo(CODESET);
 #endif
         if (codeset)
-             utf8locale = (ibcmp(codeset,  "UTF-8", 5) == 0 ||
-                           ibcmp(codeset,  "UTF8",  4) == 0);
+             utf8locale = (Perl_ibcmp(aTHX_ codeset, STR_WITH_LEN("UTF-8")) == 0 ||
+                           Perl_ibcmp(aTHX_ codeset, STR_WITH_LEN("UTF8") ) == 0);
 #if defined(USE_LOCALE)
         else { /* nl_langinfo(CODESET) is supposed to correctly
                 * interpret the locale environment variables,
                 * but just in case it fails, let's do this manually. */ 
              if (lang)
-                  utf8locale = (ibcmp(lang,     "UTF-8", 5) == 0 ||
-                                ibcmp(lang,     "UTF8",  4) == 0);
+                  utf8locale = (Perl_ibcmp(aTHX_ lang, STR_WITH_LEN("UTF-8")) == 0 ||
+                                Perl_ibcmp(aTHX_ lang, STR_WITH_LEN("UTF8") ) == 0);
 #ifdef USE_LOCALE_CTYPE
              if (curctype)
-                  utf8locale = (ibcmp(curctype,     "UTF-8", 5) == 0 ||
-                                ibcmp(curctype,     "UTF8",  4) == 0);
+                  utf8locale = (Perl_ibcmp(aTHX_ curctype, STR_WITH_LEN("UTF-8")) == 0 ||
+                                Perl_ibcmp(aTHX_ curctype, STR_WITH_LEN("UTF8") ) == 0);
 #endif
              if (lc_all)
-                  utf8locale = (ibcmp(lc_all,   "UTF-8", 5) == 0 ||
-                                ibcmp(lc_all,   "UTF8",  4) == 0);
+                  utf8locale = (Perl_ibcmp(aTHX_ lc_all, STR_WITH_LEN("UTF-8")) == 0 ||
+                                Perl_ibcmp(aTHX_ lc_all, STR_WITH_LEN("UTF8") ) == 0);
         }
 #endif /* USE_LOCALE */
         if (utf8locale)
@@ -555,6 +561,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
 char *
 Perl_mem_collxfrm(pTHX_ const char *s, STRLEN len, STRLEN *xlen)
 {
+    dVAR;
     char *xbuf;
     STRLEN xAlloc, xin, xout; /* xalloc is a reserved word in VC */