diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2015-05-21 17:06:27 -0400 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2015-06-03 12:07:09 +1000 |
commit | 1c68cbf70f1d1b9aaa6a927943d4f1c075ce8d1c (patch) | |
tree | acdc2fbdf06ff9ec144cec709ab13b21bcc1a96a /win32 | |
parent | 269713a163ea7f178a8c2a31d3c0e5caf5cbf7ce (diff) | |
download | perl-1c68cbf70f1d1b9aaa6a927943d4f1c075ce8d1c.tar.gz |
refactor win32_get_*lib() funcs to match rest of PERL_IMPLICIT_SYS API
The front end of PERL_IMPLICIT_SYS is PerlEnv_*/PerlSock_*/PerlProc_*/etc
macros. These are either macroed to C vtable calls when PERL_IMPLICIT_SYS
is on, or to the backend raw win32_*() functions when PERL_IMPLICIT_SYS
is off.
win32_get_*() were not following this convention. All this code looks like
a hack as if someone didn't have perms to edit perl.c, but they did have
perms to edit /win32, so they devise a scheme of hooking "unhooked"
win32_get_*() functions with win32.h macros for win32_get_*() to call the
Perl*() virutalization macros, and rename the original function bodies in
win32.c to g_win32_get_*() as to not make a macro loop.
Undo all of this hack by having perl.c call correct PerlEnv_* macro. This
refactoring will be useful for a future patch in #123658 to disable
win32 registry lookups.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/config_H.ce | 4 | ||||
-rw-r--r-- | win32/config_H.gc | 4 | ||||
-rw-r--r-- | win32/config_H.vc | 4 | ||||
-rw-r--r-- | win32/config_h.PL | 7 | ||||
-rw-r--r-- | win32/perlhost.h | 9 | ||||
-rw-r--r-- | win32/win32.c | 6 | ||||
-rw-r--r-- | win32/win32.h | 3 | ||||
-rw-r--r-- | win32/wince.c | 6 |
8 files changed, 15 insertions, 28 deletions
diff --git a/win32/config_H.ce b/win32/config_H.ce index 196f419ab7..1938d5f485 100644 --- a/win32/config_H.ce +++ b/win32/config_H.ce @@ -3382,7 +3382,7 @@ * in programs that are not prepared to deal with ~ expansion at run-time. */ #define PRIVLIB "\\Storage Card\\perl58m\\lib" /**/ -#define PRIVLIB_EXP (win32_get_privlib(PERL_VERSION_STRING, NULL)) /**/ +#define PRIVLIB_EXP (PerlEnv_lib_path(PERL_VERSION_STRING, NULL)) /**/ /* PTRSIZE: * This symbol contains the size of a pointer, so that the C preprocessor @@ -3513,7 +3513,7 @@ * be tacked onto this variable to generate a list of directories to search. */ #define SITELIB "\\Storage Card\\perl58m\\site\\lib" /**/ -#define SITELIB_EXP (win32_get_sitelib(PERL_VERSION_STRING, NULL)) /**/ +#define SITELIB_EXP (PerlEnv_sitelib_path(PERL_VERSION_STRING, NULL)) /**/ #define SITELIB_STEM "" /**/ /* Size_t_size: diff --git a/win32/config_H.gc b/win32/config_H.gc index 40ce6c7157..a51bee65e2 100644 --- a/win32/config_H.gc +++ b/win32/config_H.gc @@ -3064,7 +3064,7 @@ * in programs that are not prepared to deal with ~ expansion at run-time. */ #define PRIVLIB "c:\\perl\\lib" /**/ -#define PRIVLIB_EXP (win32_get_privlib(PERL_VERSION_STRING, NULL)) /**/ +#define PRIVLIB_EXP (PerlEnv_lib_path(PERL_VERSION_STRING, NULL)) /**/ /* CAN_PROTOTYPE: * If defined, this macro indicates that the C compiler can handle @@ -3231,7 +3231,7 @@ * be tacked onto this variable to generate a list of directories to search. */ #define SITELIB "c:\\perl\\site\\lib" /**/ -#define SITELIB_EXP (win32_get_sitelib(PERL_VERSION_STRING, NULL)) /**/ +#define SITELIB_EXP (PerlEnv_sitelib_path(PERL_VERSION_STRING, NULL)) /**/ #define SITELIB_STEM "" /**/ /* Size_t_size: diff --git a/win32/config_H.vc b/win32/config_H.vc index 1253e7502d..3444bce59c 100644 --- a/win32/config_H.vc +++ b/win32/config_H.vc @@ -3056,7 +3056,7 @@ * in programs that are not prepared to deal with ~ expansion at run-time. */ #define PRIVLIB "c:\\perl\\lib" /**/ -#define PRIVLIB_EXP (win32_get_privlib(PERL_VERSION_STRING, NULL)) /**/ +#define PRIVLIB_EXP (PerlEnv_lib_path(PERL_VERSION_STRING, NULL)) /**/ /* CAN_PROTOTYPE: * If defined, this macro indicates that the C compiler can handle @@ -3223,7 +3223,7 @@ * be tacked onto this variable to generate a list of directories to search. */ #define SITELIB "c:\\perl\\site\\lib" /**/ -#define SITELIB_EXP (win32_get_sitelib(PERL_VERSION_STRING, NULL)) /**/ +#define SITELIB_EXP (PerlEnv_sitelib_path(PERL_VERSION_STRING, NULL)) /**/ #define SITELIB_STEM "" /**/ /* Size_t_size: diff --git a/win32/config_h.PL b/win32/config_h.PL index 03dddb3b8a..1280655422 100644 --- a/win32/config_h.PL +++ b/win32/config_h.PL @@ -63,7 +63,12 @@ while (<SH>) s#(.)/\*\*/#$1/ **/# if(/^\/\*/); #avoid "/*" inside comments if (/^\s*#define\s+(PRIVLIB|SITELIB|VENDORLIB)_EXP/) { - $_ = "#define ". $1 . "_EXP (win32_get_". lc($1) . "(PERL_VERSION_STRING, NULL))\t/**/\n"; + $_ = '#define '. $1 . '_EXP ('.( + $1 eq 'PRIVLIB' ? 'PerlEnv_lib_path' : + $1 eq 'SITELIB' ? 'PerlEnv_sitelib_path' : + $1 eq 'VENDORLIB' ? 'PerlEnv_vendorlib_path' : + die "unknown *LIB_EXP define \"$1\"" + ). "(PERL_VERSION_STRING, NULL))\t/**/\n"; } # incpush() handles archlibs, so disable them elsif (/^\s*#define\s+(ARCHLIB|SITEARCH|VENDORARCH)_EXP/) diff --git a/win32/perlhost.h b/win32/perlhost.h index b1c6c805e5..7a0c3b39d1 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -26,9 +26,6 @@ #endif START_EXTERN_C -extern char * g_win32_get_privlib(const char *pl, STRLEN *const len); -extern char * g_win32_get_sitelib(const char *pl, STRLEN *const len); -extern char * g_win32_get_vendorlib(const char *pl, STRLEN *const len); extern char * g_getlogin(void); END_EXTERN_C @@ -519,20 +516,20 @@ PerlEnvOsId(struct IPerlEnv* piPerl) char* PerlEnvLibPath(struct IPerlEnv* piPerl, const char *pl, STRLEN *const len) { - return g_win32_get_privlib(pl, len); + return win32_get_privlib(pl, len); } char* PerlEnvSiteLibPath(struct IPerlEnv* piPerl, const char *pl, STRLEN *const len) { - return g_win32_get_sitelib(pl, len); + return win32_get_sitelib(pl, len); } char* PerlEnvVendorLibPath(struct IPerlEnv* piPerl, const char *pl, STRLEN *const len) { - return g_win32_get_vendorlib(pl, len); + return win32_get_vendorlib(pl, len); } void diff --git a/win32/win32.c b/win32/win32.c index 879b6130dd..fa051ac440 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -89,12 +89,6 @@ END_EXTERN_C #define EXECF_SPAWN_NOWAIT 3 #if defined(PERL_IMPLICIT_SYS) -# undef win32_get_privlib -# define win32_get_privlib g_win32_get_privlib -# undef win32_get_sitelib -# define win32_get_sitelib g_win32_get_sitelib -# undef win32_get_vendorlib -# define win32_get_vendorlib g_win32_get_vendorlib # undef getlogin # define getlogin g_getlogin #endif diff --git a/win32/win32.h b/win32/win32.h index 7c65310d27..3b35b6c2a4 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -60,9 +60,6 @@ # ifdef PERL_GLOBAL_STRUCT # error PERL_GLOBAL_STRUCT cannot be defined with PERL_IMPLICIT_SYS # endif -# define win32_get_privlib PerlEnv_lib_path -# define win32_get_sitelib PerlEnv_sitelib_path -# define win32_get_vendorlib PerlEnv_vendorlib_path #endif #ifdef __GNUC__ diff --git a/win32/wince.c b/win32/wince.c index 61eeecbf60..b3c5b5265f 100644 --- a/win32/wince.c +++ b/win32/wince.c @@ -52,12 +52,6 @@ #define EXECF_SPAWN_NOWAIT 3 #if defined(PERL_IMPLICIT_SYS) -# undef win32_get_privlib -# define win32_get_privlib g_win32_get_privlib -# undef win32_get_sitelib -# define win32_get_sitelib g_win32_get_sitelib -# undef win32_get_vendorlib -# define win32_get_vendorlib g_win32_get_vendorlib # undef do_spawn # define do_spawn g_do_spawn # undef getlogin |