This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make the new STR_WITH_LEN() affected compile under -Dusethreads.
authorGisle Aas <gisle@activestate.com>
Wed, 4 Jan 2006 16:15:34 +0000 (16:15 +0000)
committerGisle Aas <gisle@activestate.com>
Wed, 4 Jan 2006 16:15:34 +0000 (16:15 +0000)
Can't use STR_WITH_LEN() as argument to a macro :-(

p4raw-id: //depot/perl@26649

gv.c
locale.c
mg.c
perl.c
perlio.c
pp_sys.c
sv.c
sv.h
toke.c

diff --git a/gv.c b/gv.c
index 02ac851..a2301ac 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -292,7 +292,7 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level)
     /* UNIVERSAL methods should be callable without a stash */
     if (!stash) {
        level = -1;  /* probably appropriate */
-       if(!(stash = gv_stashpvn(STR_WITH_LEN("UNIVERSAL"), FALSE)))
+       if(!(stash = gv_stashpvs("UNIVERSAL", FALSE)))
            return 0;
     }
 
@@ -375,7 +375,7 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level)
     /* if at top level, try UNIVERSAL */
 
     if (level == 0 || level == -1) {
-       HV* const lastchance = gv_stashpvn(STR_WITH_LEN("UNIVERSAL"), FALSE);
+       HV* const lastchance = gv_stashpvs("UNIVERSAL", FALSE);
 
        if (lastchance) {
            if ((gv = gv_fetchmeth(lastchance, name, len,
@@ -639,7 +639,7 @@ STATIC void
 S_require_errno(pTHX_ GV *gv)
 {
     dVAR;
-    HV* stash = gv_stashpvn(STR_WITH_LEN("Errno"), FALSE);
+    HV* stash = gv_stashpvs("Errno", FALSE);
 
     if (!stash || !(gv_fetchmethod(stash, "TIEHASH"))) {
        dSP;
@@ -650,7 +650,7 @@ S_require_errno(pTHX_ GV *gv)
                          newSVpvs("Errno"), Nullsv);
        LEAVE;
        SPAGAIN;
-       stash = gv_stashpvn(STR_WITH_LEN("Errno"), FALSE);
+       stash = gv_stashpvs("Errno", FALSE);
        if (!stash || !(gv_fetchmethod(stash, "TIEHASH")))
            Perl_croak(aTHX_ "Can't use %%! because Errno.pm is not available");
     }
index 567a97a..1df95fb 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -499,23 +499,23 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
         codeset = nl_langinfo(CODESET);
 #endif
         if (codeset)
-             utf8locale = (ibcmp(codeset, STR_WITH_LEN("UTF-8")) == 0 ||
-                           ibcmp(codeset, STR_WITH_LEN("UTF8") ) == 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, STR_WITH_LEN("UTF-8")) == 0 ||
-                                ibcmp(lang, STR_WITH_LEN("UTF8") ) == 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, STR_WITH_LEN("UTF-8")) == 0 ||
-                                ibcmp(curctype, STR_WITH_LEN("UTF8") ) == 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, STR_WITH_LEN("UTF-8")) == 0 ||
-                                ibcmp(lc_all, STR_WITH_LEN("UTF8") ) == 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)
diff --git a/mg.c b/mg.c
index f13dd36..d1bed8e 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1444,7 +1444,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
         * tell whether HINT_STRICT_REFS is in force or not.
         */
        if (!strchr(s,':') && !strchr(s,'\''))
-           sv_insert(sv, 0, 0, STR_WITH_LEN("main::"));
+           Perl_sv_insert(aTHX_ sv, 0, 0, STR_WITH_LEN("main::"));
        if (i)
            (void)rsignal(i, PL_csighandlerp);
        else
diff --git a/perl.c b/perl.c
index 728f91c..720fe15 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -1860,7 +1860,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
                        /* break the line before that space */
 
                        opts = space - pv;
-                       sv_insert(opts_prog, opts, 0,
+                       Perl_sv_insert(aTHX_ opts_prog, opts, 0,
                                  STR_WITH_LEN("\\n                       "));
                    }
 
@@ -3505,7 +3505,7 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv)
     PL_suidscript = -1;
 
     if (PL_e_script) {
-       PL_origfilename = savepvn(STR_WITH_LEN("-e"));
+       PL_origfilename = savepvs("-e");
     }
     else {
        /* if find_script() returns, it returns a malloc()-ed value */
index 6937b36..b49d978 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -867,7 +867,7 @@ XS(XS_io_MODIFY_SCALAR_ATTRIBUTES)
 SV *
 PerlIO_tab_sv(pTHX_ PerlIO_funcs *tab)
 {
-    HV * const stash = gv_stashpvn(STR_WITH_LEN("PerlIO::Layer"), TRUE);
+    HV * const stash = gv_stashpvs("PerlIO::Layer", TRUE);
     SV * const sv = sv_bless(newRV_noinc(newSViv(PTR2IV(tab))), stash);
     return sv;
 }
index 54c7605..eedabdb 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1327,7 +1327,7 @@ PP(pp_leavewrite)
                  !gv_fetchpv("top", 0, SVt_PVFM))
                    IoTOP_NAME(io) = savesvpv(topname);
                else
-                   IoTOP_NAME(io) = savepvn(STR_WITH_LEN("top"));
+                   IoTOP_NAME(io) = savepvs("top");
            }
            topgv = gv_fetchpv(IoTOP_NAME(io), 0, SVt_PVFM);
            if (!topgv || !GvFORM(topgv)) {
diff --git a/sv.c b/sv.c
index 6f296d7..e6690c1 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11175,7 +11175,7 @@ S_varname(pTHX_ GV *gv, const char gvtype, PADOFFSET targ,
        Perl_sv_catpvf(aTHX_ name, "[%"IVdf"]", (IV)aindex);
     }
     else if (subscript_type == FUV_SUBSCRIPT_WITHIN)
-       sv_insert(name, 0, 0,  STR_WITH_LEN("within "));
+       Perl_sv_insert(aTHX_ name, 0, 0,  STR_WITH_LEN("within "));
 
     return name;
 }
diff --git a/sv.h b/sv.h
index 479b442..890166f 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1425,9 +1425,11 @@ Like C<sv_catsv> but doesn't process magic.
 #define sv_2iv(sv) sv_2iv_flags(sv, SV_GMAGIC)
 #define sv_2uv(sv) sv_2uv_flags(sv, SV_GMAGIC)
 
-#define newSVpvs(str) newSVpvn(STR_WITH_LEN(str))
-#define newSVpvs_share(str) newSVpvn_share(STR_WITH_LEN(str), 0)
-#define sv_catpvs(sv, str) sv_catpvn_flags(sv, STR_WITH_LEN(str), SV_GMAGIC)
+#define newSVpvs(str) Perl_newSVpvn(aTHX_ STR_WITH_LEN(str))
+#define newSVpvs_share(str) Perl_newSVpvn_share(aTHX_ STR_WITH_LEN(str), 0)
+#define sv_catpvs(sv, str) Perl_sv_catpvn_flags(aTHX_ sv, STR_WITH_LEN(str), SV_GMAGIC)
+#define savepvs(str) Perl_savepvn(aTHX_ STR_WITH_LEN(str))
+#define gv_stashpvs(str, create) Perl_gv_stashpvn(aTHX_ STR_WITH_LEN(str), create)
 
 /* Should be named SvCatPVN_utf8_upgrade? */
 #define sv_catpvn_utf8_upgrade(dsv, sstr, slen, nsv)   \
diff --git a/toke.c b/toke.c
index 478ec7c..fba0b33 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -460,7 +460,7 @@ S_missingterm(pTHX_ char *s)
 
 #define FEATURE_IS_ENABLED(name)                                       \
        ((0 != (PL_hints & HINT_LOCALIZE_HH))                           \
-           && feature_is_enabled(STR_WITH_LEN(name)))
+           && S_feature_is_enabled(aTHX_ STR_WITH_LEN(name)))
 /*
  * S_feature_is_enabled
  * Check whether the named feature is enabled.