This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PL_cshname is actually a constant value known at compile time.
authorNicholas Clark <nick@ccl4.org>
Fri, 5 Oct 2007 20:31:23 +0000 (20:31 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 5 Oct 2007 20:31:23 +0000 (20:31 +0000)
PL_cshlen can be calculated by the compiler. So eliminate both as
interpreter variables, and the code that calculates PL_cshlen at
runtime.

p4raw-id: //depot/perl@32035

embed.fnc
embed.h
embedvar.h
intrpvar.h
perl.h
perlapi.h
proto.h
sv.c
toke.c

index fef33db..16a8574 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1541,7 +1541,6 @@ s |int    |intuit_more    |NN char *s
 s      |I32    |lop            |I32 f|int x|NN char *s
 rs     |void   |missingterm    |NULLOK char *s
 s      |void   |no_op          |NN const char *what|NULLOK char *s
-s      |void   |set_csh
 sR     |I32    |sublex_done
 sR     |I32    |sublex_push
 sR     |I32    |sublex_start
diff --git a/embed.h b/embed.h
index 9d41f69..910afa7 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define lop                    S_lop
 #define missingterm            S_missingterm
 #define no_op                  S_no_op
-#define set_csh                        S_set_csh
 #define sublex_done            S_sublex_done
 #define sublex_push            S_sublex_push
 #define sublex_start           S_sublex_start
 #define lop(a,b,c)             S_lop(aTHX_ a,b,c)
 #define missingterm(a)         S_missingterm(aTHX_ a)
 #define no_op(a,b)             S_no_op(aTHX_ a,b)
-#define set_csh()              S_set_csh(aTHX)
 #define sublex_done()          S_sublex_done(aTHX)
 #define sublex_push()          S_sublex_push(aTHX)
 #define sublex_start()         S_sublex_start(aTHX)
index 15057bc..26d5821 100644 (file)
@@ -95,8 +95,6 @@
 #define PL_comppad_name_floor  (vTHX->Icomppad_name_floor)
 #define PL_cop_seqmax          (vTHX->Icop_seqmax)
 #define PL_cryptseen           (vTHX->Icryptseen)
-#define PL_cshlen              (vTHX->Icshlen)
-#define PL_cshname             (vTHX->Icshname)
 #define PL_curcop              (vTHX->Icurcop)
 #define PL_curcopdb            (vTHX->Icurcopdb)
 #define PL_curpad              (vTHX->Icurpad)
 #define PL_Icomppad_name_floor PL_comppad_name_floor
 #define PL_Icop_seqmax         PL_cop_seqmax
 #define PL_Icryptseen          PL_cryptseen
-#define PL_Icshlen             PL_cshlen
-#define PL_Icshname            PL_cshname
 #define PL_Icurcop             PL_curcop
 #define PL_Icurcopdb           PL_curcopdb
 #define PL_Icurpad             PL_curpad
index a6a4a1c..36e8030 100644 (file)
@@ -256,11 +256,6 @@ PERLVAR(Istatusvalue_vms,U32)
 PERLVAR(Istatusvalue_posix,I32)
 #endif
 
-#ifdef CSH
-PERLVARI(Icshlen,      I32,    0)
-PERLVARI(Icshname,     const char *,   CSH)
-#endif
-
 /* shortcuts to various I/O objects */
 PERLVAR(Istdingv,      GV *)
 PERLVAR(Istderrgv,     GV *)
diff --git a/perl.h b/perl.h
index 3371a7f..31a0c58 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -4113,6 +4113,12 @@ EXTCONST char PL_no_localize_ref[]
 EXTCONST char PL_memory_wrap[]
   INIT("panic: memory wrap");
 
+#ifdef CSH
+EXTCONST char PL_cshname[]
+  INIT(CSH);
+#  define PL_cshlen    (sizeof(CSH "") - 1)
+#endif
+
 EXTCONST char PL_uuemap[65]
   INIT("`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_");
 
index 05cf09f..d924aff 100644 (file)
--- a/perlapi.h
+++ b/perlapi.h
@@ -226,10 +226,6 @@ END_EXTERN_C
 #define PL_cop_seqmax          (*Perl_Icop_seqmax_ptr(aTHX))
 #undef  PL_cryptseen
 #define PL_cryptseen           (*Perl_Icryptseen_ptr(aTHX))
-#undef  PL_cshlen
-#define PL_cshlen              (*Perl_Icshlen_ptr(aTHX))
-#undef  PL_cshname
-#define PL_cshname             (*Perl_Icshname_ptr(aTHX))
 #undef  PL_curcop
 #define PL_curcop              (*Perl_Icurcop_ptr(aTHX))
 #undef  PL_curcopdb
diff --git a/proto.h b/proto.h
index a69969d..2c891d2 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -4103,7 +4103,6 @@ STATIC void       S_missingterm(pTHX_ char *s)
 STATIC void    S_no_op(pTHX_ const char *what, char *s)
                        __attribute__nonnull__(pTHX_1);
 
-STATIC void    S_set_csh(pTHX);
 STATIC I32     S_sublex_done(pTHX)
                        __attribute__warn_unused_result__;
 
diff --git a/sv.c b/sv.c
index ded810d..bcf144f 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11271,11 +11271,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
 
     PL_runops          = proto_perl->Irunops;
 
-#ifdef CSH
-    PL_cshlen          = proto_perl->Icshlen;
-    PL_cshname         = proto_perl->Icshname; /* XXX never deallocated */
-#endif
-
     PL_parser          = parser_dup(proto_perl->Iparser, param);
 
     PL_subline         = proto_perl->Isubline;
diff --git a/toke.c b/toke.c
index 7037a43..1747114 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -2969,9 +2969,6 @@ S_readpipe_override(pTHX)
                newSVOP(OP_CONST, 0, &PL_sv_undef), /* value will be read later */
                newCVREF(0, newGVOP(OP_GV, 0, gv_readpipe))));
     }
-    else {
-       set_csh();
-    }
 }
 
 #ifdef PERL_MAD 
@@ -5928,7 +5925,6 @@ Perl_yylex(pTHX)
            UNI(OP_EACH);
 
        case KEY_exec:
-           set_csh();
            LOP(OP_EXEC,XREF);
 
        case KEY_endhostent:
@@ -6093,7 +6089,6 @@ Perl_yylex(pTHX)
            OPERATOR(GIVEN);
 
        case KEY_glob:
-           set_csh();
            LOP(OP_GLOB,XTERM);
 
        case KEY_hex:
@@ -6435,11 +6430,9 @@ Perl_yylex(pTHX)
            UNI(OP_READDIR);
 
        case KEY_readline:
-           set_csh();
            UNIDOR(OP_READLINE);
 
        case KEY_readpipe:
-           set_csh();
            UNIDOR(OP_BACKTICK);
 
        case KEY_rewinddir:
@@ -6758,7 +6751,6 @@ Perl_yylex(pTHX)
            }
 
        case KEY_system:
-           set_csh();
            LOP(OP_SYSTEM,XREF);
 
        case KEY_symlink:
@@ -11396,7 +11388,6 @@ S_scan_inputsymbol(pTHX_ char *start)
 
     if (d - PL_tokenbuf != len) {
        yylval.ival = OP_GLOB;
-       set_csh();
        s = scan_str(start,!!PL_madskills,FALSE);
        if (!s)
           Perl_croak(aTHX_ "Glob not terminated");
@@ -12398,20 +12389,6 @@ S_scan_formline(pTHX_ register char *s)
     return s;
 }
 
-STATIC void
-S_set_csh(pTHX)
-{
-#ifdef CSH
-    dVAR;
-    if (!PL_cshlen)
-       PL_cshlen = strlen(PL_cshname);
-#else
-#if defined(USE_ITHREADS)
-    PERL_UNUSED_CONTEXT;
-#endif
-#endif
-}
-
 I32
 Perl_start_subparse(pTHX_ I32 is_format, U32 flags)
 {