From 09635b7d339deb8916bd6426ccc94392b172f066 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 15 Jul 2013 13:33:04 -0400 Subject: make sure to do all fetches with the proper context If we're fetching a glob for the purposes of writing to it, it shouldn't trigger read magic. The way to suppress that in calls to hv_fetch_ent is to pass a true value as the 'lval' parameter, which we were already doing elsewhere, just not in _expand_glob. get_all_symbols is only used for reading purposes, so it should unconditionally trigger read magic. --- XS.xs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'XS.xs') diff --git a/XS.xs b/XS.xs index 1a1be34..a3cd205 100644 --- a/XS.xs +++ b/XS.xs @@ -372,7 +372,7 @@ static void _real_gv_init(GV *gv, HV *stash, SV *name) } } -static void _expand_glob(SV *self, SV *varname) +static void _expand_glob(SV *self, SV *varname, int lval) { HV *namespace; HE *entry; @@ -380,7 +380,7 @@ static void _expand_glob(SV *self, SV *varname) namespace = _get_namespace(self); - if (entry = hv_fetch_ent(namespace, varname, 0, 0)) { + if (entry = hv_fetch_ent(namespace, varname, lval, 0)) { glob = (GV*)HeVAL(entry); if (isGV(glob)) { croak("_expand_glob called on stash slot with expanded glob: %"SVf, @@ -514,7 +514,7 @@ static SV *_get_symbol(SV *self, varspec_t *variable, int vivify) glob = (GV*)(HeVAL(entry)); if (!isGV(glob)) - _expand_glob(self, variable->name); + _expand_glob(self, variable->name, vivify); if (vivify && !_slot_exists(glob, variable->type)) { _add_symbol(self, *variable, NULL); @@ -921,7 +921,7 @@ get_all_symbols(self, vartype=VAR_NONE) if (!isGV(gv)) { SV *keysv = newSVpvn(key, len); - _expand_glob(self, keysv); + _expand_glob(self, keysv, 0); SvREFCNT_dec(keysv); } -- cgit v1.2.3-54-g00ecf