diff --git a/universal.c b/universal.c index 1e039d1936e1..f9d2348026c6 100644 --- a/universal.c +++ b/universal.c @@ -123,20 +123,33 @@ S_sv_derived_from_svpvn(pTHX_ SV *sv, SV *namesv, const char * name, const STRLE /* =for apidoc_section $SV -=for apidoc sv_derived_from_pvn +=for apidoc sv_derived_from +=for apidoc_item sv_derived_from_hv +=for apidoc_item sv_derived_from_pv +=for apidoc_item sv_derived_from_pvn +=for apidoc_item sv_derived_from_sv -Returns a boolean indicating whether the SV is derived from the specified class -I. To check derivation at the Perl level, call C as a -normal Perl method. +These each return a boolean indicating whether C is derived from the +specified class I. To check derivation at the Perl level, call +C as a normal Perl method. -Currently, the only significant value for C is SVf_UTF8. +In C, the class name is C (which would +presumably represent a stash). Its UTF8ness is C. -=cut +In C and C, the class name is given by +C, which is a NUL-terminated C string. In C, the name +is never considered to be encoded as UTF-8. + +The remaining forms differ only in how the class name is specified; +they all have a C parameter. Currently, the only significant value for +which is C to indicate that the class name is encoded as such. -=for apidoc sv_derived_from_sv +In C, the class name is extracted from C. +This is the preferred form. The class name is considered to be in UTF-8 if +C is marked as such. -Exactly like L, but takes the name string in the form -of an SV instead of a string/length pair. This is the advised form. +In C, C gives the length of C, so the latter +may contain embedded NUL characters. =cut @@ -149,14 +162,6 @@ Perl_sv_derived_from_sv(pTHX_ SV *sv, SV *namesv, U32 flags) return sv_derived_from_svpvn(sv, namesv, NULL, 0, flags); } -/* -=for apidoc sv_derived_from - -Exactly like L, but doesn't take a C parameter. - -=cut -*/ - bool Perl_sv_derived_from(pTHX_ SV *sv, const char *const name) { @@ -164,15 +169,6 @@ Perl_sv_derived_from(pTHX_ SV *sv, const char *const name) return sv_derived_from_svpvn(sv, NULL, name, strlen(name), 0); } -/* -=for apidoc sv_derived_from_pv - -Exactly like L, but takes a nul-terminated string -instead of a string/length pair. - -=cut -*/ - bool Perl_sv_derived_from_pv(pTHX_ SV *sv, const char *const name, U32 flags) @@ -188,15 +184,6 @@ Perl_sv_derived_from_pvn(pTHX_ SV *sv, const char *const name, const STRLEN len, return sv_derived_from_svpvn(sv, NULL, name, len, flags); } -/* -=for apidoc sv_derived_from_hv - -Exactly like L, but takes the name string as the -C of the given HV (which would presumably represent a stash). - -=cut -*/ - bool Perl_sv_derived_from_hv(pTHX_ SV *sv, HV *hv) {