On Wed May 20 22:01:34 2015, tonyc wrote:
> You need to update win32/config_h.PL, which is used to update> win32/config_H.*> > Otherwise the next nmake regen_config_h will revert your changes.> > Tony
Updated patch attached.
--
bulk88 ~ bulk88 at hotmail.com
---
via perlbug: queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=125225
From a3bd2230055c931ccab306b46333a55e188de853 Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bul...@hotmail.com>
Date: Thu, 21 May 2015 17:06:27 -0400
Subject: [PATCH] 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.
---
perl.c | 6 +++---
win32/config_H.ce | 4 ++--
win32/config_H.gc | 4 ++--
win32/config_H.vc | 4 ++--
win32/config_h.PL | 7 ++++++-
win32/perlhost.h | 9 +++------
win32/win32.c | 6 ------
win32/win32.h | 3 ---
win32/wince.c | 6 ------
9 files changed, 18 insertions(+), 31 deletions(-)
diff --git a/perl.c b/perl.c
index 086645b..83ee6f4 100644
--- a/perl.c
+++ b/perl.c
@@ -4385,7 +4385,7 @@ S_init_perllib(pTHX)
#ifdef SITELIB_EXP
# if defined(WIN32)
/* this picks up sitearch as well */
- s = win32_get_sitelib(PERL_FS_VERSION, &len);
+ s = PerlEnv_sitelib_path(PERL_FS_VERSION, &len);
if (s)
incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE);
# else
@@ -4405,7 +4405,7 @@ S_init_perllib(pTHX)
#ifdef PERL_VENDORLIB_EXP
# if defined(WIN32)
/* this picks up vendorarch as well */
- s = win32_get_vendorlib(PERL_FS_VERSION, &len);
+ s = PerlEnv_vendorlib_path(PERL_FS_VERSION, &len);
if (s)
incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE);
# else
@@ -4423,7 +4423,7 @@ S_init_perllib(pTHX)
#endif
#if defined(WIN32)
- s = win32_get_privlib(PERL_FS_VERSION, &len);
+ s = PerlEnv_lib_path(PERL_FS_VERSION, &len);
if (s)
incpush_use_sep(s, len, INCPUSH_ADD_SUB_DIRS|INCPUSH_CAN_RELOCATE);
#else
diff --git a/win32/config_H.ce b/win32/config_H.ce
index 196f419..1938d5f 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 a549e88..8812510 100644
--- a/win32/config_H.gc
+++ b/win32/config_H.gc
@@ -3062,7 +3062,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
@@ -3229,7 +3229,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 909f3d5..58e5fbb 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 03dddb3..1280655 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 0637f8e..2ec48eb 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 aaa999b..0fdde79 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 3aef480..662be30 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -62,9 +62,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 61eeecb..b3c5b52 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
--
1.7.9.msysgit.0