diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2022-10-25 15:37:00 +0100 |
---|---|---|
committer | Paul Evans <leonerd@leonerd.org.uk> | 2022-10-25 17:03:27 +0100 |
commit | 8f0b3fcc4329e278204a58fd52feabdf9e4c5681 (patch) | |
tree | 84f8d9e59ddc6698271f30b5d322ef3cbccd37b2 /universal.c | |
parent | dd8f4e6b1cdd0b2bce8bb0601054d575b69b4265 (diff) | |
download | perl-8f0b3fcc4329e278204a58fd52feabdf9e4c5681.tar.gz |
Add sv_derived_from_hv() helper function
Diffstat (limited to 'universal.c')
-rw-r--r-- | universal.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/universal.c b/universal.c index fe221dcedd..119117e818 100644 --- a/universal.c +++ b/universal.c @@ -189,6 +189,27 @@ Perl_sv_derived_from_pvn(pTHX_ SV *sv, const char *const name, const STRLEN len, } /* +=for apidoc sv_derived_from_hv + +Exactly like L</sv_derived_from_pvn>, but takes the name string as the +C<HvNAME> of the given HV (which would presumably represent a stash). + +=cut +*/ + +bool +Perl_sv_derived_from_hv(pTHX_ SV *sv, HV *hv) +{ + PERL_ARGS_ASSERT_SV_DERIVED_FROM_HV; + + const char *hvname = HvNAME(hv); + if(!hvname) + return FALSE; + + return sv_derived_from_svpvn(sv, NULL, hvname, HvNAMELEN(hv), HvNAMEUTF8(hv) ? SVf_UTF8 : 0); +} + +/* =for apidoc sv_isa_sv Returns a boolean indicating whether the SV is an object reference and is |