Skip to content

Commit

Permalink
Comment about some subtleties in S_init_postdump_symbols().
Browse files Browse the repository at this point in the history
  • Loading branch information
nwc10 committed Aug 23, 2021
1 parent 43231a2 commit 5fe1e1c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions perl.c
Expand Up @@ -4624,6 +4624,17 @@ S_init_postdump_symbols(pTHX_ int argc, char **argv, char **env)
(void)strupr(old_var);
*s = '=';
#endif
/* It's tempting to think that this hv_exists/hv_store pair should
* be replaced with a single hv_fetch with the LVALUE flag true.
* However, hv has magic, and if you follow the code in hv_common
* then for LVALUE fetch it recurses once, whereas exists and
* store do not recurse. Hence internally there would be no
* difference in the complexity of the code run. Moreover, all
* calls pass through "is there magic?" special case code, which
* in turn has its own #ifdef ENV_IS_CASELESS special case special
* case. Hence this code shouldn't change, as doing so won't give
* any meaningful speedup, and might well add bugs. */

if (hv_exists(hv, old_var, nlen)) {
const char *name = savepvn(old_var, nlen);

Expand Down

0 comments on commit 5fe1e1c

Please sign in to comment.