summaryrefslogtreecommitdiff
path: root/win32/win32.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2021-09-12 08:44:52 +0000
committerCraig A. Berry <craigberry@mac.com>2021-09-15 16:24:06 -0500
commitd5a0a5dd15db7407246717e8c3e8891b9ba7c53c (patch)
treedc6c0a224a72d26aac913d171dae5729beb6a8e4 /win32/win32.h
parente893e12ccfed2a8d5f0649a8cc133249ca7373ff (diff)
downloadperl-d5a0a5dd15db7407246717e8c3e8891b9ba7c53c.tar.gz
Simplify the code related to prime_env_iter().
Of the platforms that define DYNAMIC_ENV_FETCH, prime_env_iter() is only needed on VMS, so only call it on VMS. Previously we defined a dummy stub on Win32 (with PERL_IMPLICIT_SYS defined), and did something different again for __riscos__. Remove the dummy definition for win32, and change the conditional compilation to only call prime_env_iter() on VMS. This removes a call to mg_find() on Win32, which likely can't be optimised away, as the compiler cannot know that it has no side effects. Because`iter` points to a structure immediately after of HvARRAY(), it needs updating if HvARRAY() has moved because it has been expanded. Code was added for VMS in Aug 2005 to address this bug with commit 03026e68943709ca: [patch@25334] hv.c vms environment fix. From: "John E. Malmberg" <wb8tyw@qsl.net> Message-ID: <4310F552.8050401@qsl.net> see https://www.nntp.perl.org/group/perl.perl5.porters/2005/08/msg104261.html However, the comment added in that code wasn't entirely accurate. The iteration count doesn't need to be *reset* because prior to that first call to prime_env_iter() there would be no entries in the hash. In fact, the iterator *had* to be in its "reset" state - entry == NULL - to enter the if block. Also, as prime_env_iter() only adds hash values but does not change the hash's iterator state, it can't change iter->xhv_eiter. Hence there's no need to re-read *that* value, is it will still be NULL. Hence the only action needed is to re-initialise iter from HvAUX(), as the structure it needs to point to has likely been moved in memory by the hash stores performed by prime_env_iter().
Diffstat (limited to 'win32/win32.h')
-rw-r--r--win32/win32.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/win32/win32.h b/win32/win32.h
index 6d5e186204..5a2f903f58 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -57,7 +57,6 @@
#if defined(PERL_IMPLICIT_SYS)
# define DYNAMIC_ENV_FETCH
# define HAS_GETENV_LEN
-# define prime_env_iter()
# define WIN32IO_IS_STDIO /* don't pull in custom stdio layer */
# define WIN32SCK_IS_STDSCK /* don't pull in custom wsock layer */
#endif