diff options
author | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-05-26 11:38:45 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-05-26 11:38:45 +0000 |
commit | 5bc6513ddd9360f3cbfa6bf29425e38b658230f5 (patch) | |
tree | 5ee77e4046c2720ba400fddad7f9ff89e77b1126 | |
parent | 97fcbf9696d4cdc3d47f383b99d9840ccb39c616 (diff) | |
download | perl-5bc6513ddd9360f3cbfa6bf29425e38b658230f5.tar.gz |
Add avhv_store_ent. Add missing avhv_* to global.sym.
p4raw-id: //depot/perl@20
-rw-r--r-- | av.c | 26 | ||||
-rw-r--r-- | global.sym | 4 |
2 files changed, 30 insertions, 0 deletions
@@ -561,6 +561,32 @@ U32 hash; return av_store(av, ind, val); } +SV** +avhv_store_ent(av, keysv, val, hash) +AV *av; +SV *keysv; +SV *val; +U32 hash; +{ + SV **keys; + HE *he; + I32 ind; + + keys = av_fetch(av, 0, FALSE); + if (!keys || !SvROK(*keys) || SvTYPE(SvRV(*keys)) != SVt_PVHV) + croak("Can't coerce array into hash"); + he = hv_fetch_ent((HV*)SvRV(*keys), keysv, FALSE, hash); + if (he) { + ind = SvIV(HeVAL(he)); + if (ind < 1) + croak("Bad index while coercing array into hash"); + } else { + ind = AvFILL(av) + 1; + hv_store_ent((HV*)SvRV(*keys), keysv, newSViv(ind), hash); + } + return av_store(av, ind, val); +} + bool avhv_exists_ent(av, keysv, hash) AV *av; diff --git a/global.sym b/global.sym index 1a8dd7f231..27d80c5dc3 100644 --- a/global.sym +++ b/global.sym @@ -303,13 +303,17 @@ append_list apply assertref avhv_delete +avhv_delete_ent avhv_exists +avhv_exists_ent avhv_fetch +avhv_fetch_ent avhv_iterinit avhv_iternext avhv_iternextsv avhv_iterval avhv_store +avhv_store_ent av_clear av_extend av_fake |