Introduce a new preprocessor symbol, PERL_DISABLE_PMC, to
Rafael Garcia-Suarez [Wed, 21 May 2003 19:56:38 +0000 (19:56 +0000)]
disable the loading of .pmc files if defined.
Rename the function S_doopen_pmc to S_doopen_pm.

p4raw-id: //depot/perl@19586

Porting/thirdclean
embed.fnc
embed.h
pp_ctl.c
proto.h

index c45de15..86103f7 100644 (file)
@@ -28,7 +28,7 @@ $leak[ 0] =~ s/.* were found:\n\n//m; # Snip off totals.
 # actual length.
 @accv = grep { ! /-- rih --.+(?:memmove|strcpy).+moreswitches/s }  @accv;
 @accv = grep { ! /-- (?:rih|rus) --.+strcpy.+gv_fetchfile/s }      @accv;
-@accv = grep { ! /-- rih --.+strcmp.+doopen_pmc/s }                @accv;
+@accv = grep { ! /-- rih --.+strcmp.+doopen_pm/s }                 @accv;
 @accv = grep { ! /-- rih --.+strcmp.+gv_fetchpv/s }                @accv;
 @accv = grep { ! /-- r[ui]h --.+strcmp.+gv_fetchmeth/s }           @accv;
 @accv = grep { ! /-- rih --.+memmove.+my_setenv/s }                @accv;
index 0d906a4..b28230e 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1090,7 +1090,7 @@ s |I32    |dopoptosub     |I32 startingblock
 s      |I32    |dopoptosub_at  |PERL_CONTEXT* cxstk|I32 startingblock
 s      |void   |save_lines     |AV *array|SV *sv
 s      |OP*    |doeval         |int gimme|OP** startop|CV* outside|U32 seq
-s      |PerlIO *|doopen_pmc    |const char *name|const char *mode
+s      |PerlIO *|doopen_pm     |const char *name|const char *mode
 s      |bool   |path_is_absolute|char *name
 #endif
 
diff --git a/embed.h b/embed.h
index 8f8853f..71270d8 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define doeval                 S_doeval
 #endif
 #ifdef PERL_CORE
-#define doopen_pmc             S_doopen_pmc
+#define doopen_pm              S_doopen_pm
 #endif
 #ifdef PERL_CORE
 #define path_is_absolute       S_path_is_absolute
 #define doeval(a,b,c,d)                S_doeval(aTHX_ a,b,c,d)
 #endif
 #ifdef PERL_CORE
-#define doopen_pmc(a,b)                S_doopen_pmc(aTHX_ a,b)
+#define doopen_pm(a,b)         S_doopen_pm(aTHX_ a,b)
 #endif
 #ifdef PERL_CORE
 #define path_is_absolute(a)    S_path_is_absolute(aTHX_ a)
index 8665678..2380d5d 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2936,8 +2936,9 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq)
 }
 
 STATIC PerlIO *
-S_doopen_pmc(pTHX_ const char *name, const char *mode)
+S_doopen_pm(pTHX_ const char *name, const char *mode)
 {
+#ifndef PERL_DISABLE_PMC
     STRLEN namelen = strlen(name);
     PerlIO *fp;
 
@@ -2965,6 +2966,9 @@ S_doopen_pmc(pTHX_ const char *name, const char *mode)
        fp = PerlIO_open(name, mode);
     }
     return fp;
+#else
+    return PerlIO_open(name, mode);
+#endif /* !PERL_DISABLE_PMC */
 }
 
 PP(pp_require)
@@ -3063,7 +3067,7 @@ PP(pp_require)
 
     if (path_is_absolute(name)) {
        tryname = name;
-       tryrsfp = doopen_pmc(name,PERL_SCRIPT_MODE);
+       tryrsfp = doopen_pm(name,PERL_SCRIPT_MODE);
     }
 #ifdef MACOS_TRADITIONAL
     if (!tryrsfp) {
@@ -3072,7 +3076,7 @@ PP(pp_require)
        MacPerl_CanonDir(name, newname, 1);
        if (path_is_absolute(newname)) {
            tryname = newname;
-           tryrsfp = doopen_pmc(newname,PERL_SCRIPT_MODE);
+           tryrsfp = doopen_pm(newname,PERL_SCRIPT_MODE);
        }
     }
 #endif
@@ -3227,7 +3231,7 @@ PP(pp_require)
 #endif
                    TAINT_PROPER("require");
                    tryname = SvPVX(namesv);
-                   tryrsfp = doopen_pmc(tryname, PERL_SCRIPT_MODE);
+                   tryrsfp = doopen_pm(tryname, PERL_SCRIPT_MODE);
                    if (tryrsfp) {
                        if (tryname[0] == '.' && tryname[1] == '/')
                            tryname += 2;
diff --git a/proto.h b/proto.h
index fbac1d7..c9994e9 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -1127,7 +1127,7 @@ STATIC I32        S_dopoptosub(pTHX_ I32 startingblock);
 STATIC I32     S_dopoptosub_at(pTHX_ PERL_CONTEXT* cxstk, I32 startingblock);
 STATIC void    S_save_lines(pTHX_ AV *array, SV *sv);
 STATIC OP*     S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq);
-STATIC PerlIO *        S_doopen_pmc(pTHX_ const char *name, const char *mode);
+STATIC PerlIO *        S_doopen_pm(pTHX_ const char *name, const char *mode);
 STATIC bool    S_path_is_absolute(pTHX_ char *name);
 #endif