diff options
author | David Mitchell <davem@iabyn.com> | 2017-07-21 14:32:57 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-07-27 11:30:24 +0100 |
commit | 8dc9003ff3914e78971f561eaece965e9ceeb49e (patch) | |
tree | 9ddb6c6946453365682c422f311a985fce2725ef /pp_hot.c | |
parent | a16ac36c3b97d0d80762b2900667f3759f354d9f (diff) | |
download | perl-8dc9003ff3914e78971f561eaece965e9ceeb49e.tar.gz |
hv_pushkv(): handle keys() and values() too
The newish function hv_pushkv() currently just pushes all key/value pairs on
the stack. i.e. it does the equivalent of the perl code '() = %h'.
Extend it so that it can handle 'keys %h' and values %h' too.
This is basically moving the remaining list-context functionality out of
do_kv() and into hv_pushkv().
The rationale for this is that hv_pushkv() is a pure HV-related function,
while do_kv() is a pp function for several ops including OP_KEYS/VALUES,
and expects PL_op->op_flags/op_private to be valid.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -983,7 +983,7 @@ S_padhv_rv2hv_common(pTHX_ HV *hv, U8 gimme, bool is_keys, bool has_targ) assert(PL_op->op_type == OP_PADHV || PL_op->op_type == OP_RV2HV); if (gimme == G_ARRAY) { - hv_pushkv(hv); + hv_pushkv(hv, 3); return NORMAL; } |