diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-03 17:48:31 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-03 17:48:31 +0000 |
commit | d6a71824a1e9d5ec2e4050f5e51f00e0aed29f1b (patch) | |
tree | 750e204e55ff0008040249f2114df3d38df43fcf /av.c | |
parent | 36a610e7b0fe7aeba731ed87207f6ee17accb3e7 (diff) | |
download | perl-d6a71824a1e9d5ec2e4050f5e51f00e0aed29f1b.tar.gz |
support for list assignment to pseudohashes (from John Tobey
<jtobey@john-edwin-tobey.org>)
p4raw-id: //depot/perl@5492
Diffstat (limited to 'av.c')
-rw-r--r-- | av.c | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -805,6 +805,20 @@ S_avhv_index_sv(pTHX_ SV* sv) return index; } +STATIC I32 +S_avhv_index(pTHX_ AV *av, SV *keysv, U32 hash) +{ + HV *keys; + HE *he; + STRLEN n_a; + + keys = avhv_keys(av); + he = hv_fetch_ent(keys, keysv, FALSE, hash); + if (!he) + Perl_croak(aTHX_ "No such pseudo-hash field \"%s\"", SvPV(keysv,n_a)); + return avhv_index_sv(HeVAL(he)); +} + HV* Perl_avhv_keys(pTHX_ AV *av) { @@ -824,17 +838,15 @@ Perl_avhv_keys(pTHX_ AV *av) } SV** +Perl_avhv_store_ent(pTHX_ AV *av, SV *keysv, SV *val, U32 hash) +{ + return av_store(av, avhv_index(av, keysv, hash), val); +} + +SV** Perl_avhv_fetch_ent(pTHX_ AV *av, SV *keysv, I32 lval, U32 hash) { - SV **indsvp; - HV *keys = avhv_keys(av); - HE *he; - STRLEN n_a; - - he = hv_fetch_ent(keys, keysv, FALSE, hash); - if (!he) - Perl_croak(aTHX_ "No such pseudo-hash field \"%s\"", SvPV(keysv,n_a)); - return av_fetch(av, avhv_index_sv(HeVAL(he)), lval); + return av_fetch(av, avhv_index(av, keysv, hash), lval); } SV * |