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 | 10c8fecdc2f0a2ef9c548abff5961fa25cd83eca (patch) | |
tree | 750e204e55ff0008040249f2114df3d38df43fcf /av.c | |
parent | 49cb0e56d106a6666efa8660569a458b7eb3368b (diff) | |
download | perl-10c8fecdc2f0a2ef9c548abff5961fa25cd83eca.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 * |