If PERL_DISABLE_PMC is defined, doopen_pm() is just a direct call to
Nicholas Clark [Tue, 9 Oct 2007 21:32:50 +0000 (21:32 +0000)]
check_type_and_open(). So for this case make it a macro, to save a
level of function call.

p4raw-id: //depot/perl@32088

embed.fnc
embed.h
pp_ctl.c
proto.h

index 6030e5c..d4fa4be 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1324,7 +1324,9 @@ sR        |I32    |dopoptowhen    |I32 startingblock
 s      |void   |save_lines     |NULLOK AV *array|NN SV *sv
 s      |bool   |doeval         |int gimme|NULLOK OP** startop|NULLOK CV* outside|U32 seq
 sR     |PerlIO *|check_type_and_open|NN const char *name
+#ifndef PERL_DISABLE_PMC
 sR     |PerlIO *|doopen_pm     |NN const char *name|const STRLEN namelen
+#endif
 sRn    |bool   |path_is_absolute|NN const char *name
 sR     |I32    |run_user_filter|int idx|NN SV *buf_sv|int maxlen
 sR     |PMOP*  |make_matcher   |NN regexp* re
diff --git a/embed.h b/embed.h
index 418f794..56b7a4b 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define save_lines             S_save_lines
 #define doeval                 S_doeval
 #define check_type_and_open    S_check_type_and_open
+#endif
+#ifndef PERL_DISABLE_PMC
+#ifdef PERL_CORE
 #define doopen_pm              S_doopen_pm
+#endif
+#endif
+#ifdef PERL_CORE
 #define path_is_absolute       S_path_is_absolute
 #define run_user_filter                S_run_user_filter
 #define make_matcher           S_make_matcher
 #define save_lines(a,b)                S_save_lines(aTHX_ a,b)
 #define doeval(a,b,c,d)                S_doeval(aTHX_ a,b,c,d)
 #define check_type_and_open(a) S_check_type_and_open(aTHX_ a)
+#endif
+#ifndef PERL_DISABLE_PMC
+#ifdef PERL_CORE
 #define doopen_pm(a,b)         S_doopen_pm(aTHX_ a,b)
+#endif
+#endif
+#ifdef PERL_CORE
 #define path_is_absolute       S_path_is_absolute
 #define run_user_filter(a,b,c) S_run_user_filter(aTHX_ a,b,c)
 #define make_matcher(a)                S_make_matcher(aTHX_ a)
index 0213074..0968dd4 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3018,10 +3018,10 @@ S_check_type_and_open(pTHX_ const char *name)
     return PerlIO_open(name, PERL_SCRIPT_MODE);
 }
 
+#ifndef PERL_DISABLE_PMC
 STATIC PerlIO *
 S_doopen_pm(pTHX_ const char *name, const STRLEN namelen)
 {
-#ifndef PERL_DISABLE_PMC
     PerlIO *fp;
 
     if (namelen > 3 && strEQ(name + namelen - 3, ".pm")) {
@@ -3045,10 +3045,10 @@ S_doopen_pm(pTHX_ const char *name, const STRLEN namelen)
        fp = check_type_and_open(name);
     }
     return fp;
+}
 #else
-    return check_type_and_open(name);
+#  define doopen_pm(name, namelen) check_type_and_open(name)
 #endif /* !PERL_DISABLE_PMC */
-}
 
 PP(pp_require)
 {
diff --git a/proto.h b/proto.h
index c96c1d3..0bb7220 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -3542,10 +3542,12 @@ STATIC PerlIO * S_check_type_and_open(pTHX_ const char *name)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1);
 
+#ifndef PERL_DISABLE_PMC
 STATIC PerlIO *        S_doopen_pm(pTHX_ const char *name, const STRLEN namelen)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1);
 
+#endif
 STATIC bool    S_path_is_absolute(const char *name)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(1);