Skip to content

Commit 45d3926

Browse files
committed
perlapi: Revise wording in sv_derived_from entry
I think this reads better
1 parent 16cabc7 commit 45d3926

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

universal.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ S_sv_derived_from_svpvn(pTHX_ SV *sv, SV *namesv, const char * name, const STRLE
113113

114114
/*
115115
=for apidoc_section $SV
116-
117116
=for apidoc sv_derived_from
118117
=for apidoc_item sv_derived_from_hv
119118
=for apidoc_item sv_derived_from_pv
@@ -124,23 +123,27 @@ These each return a boolean indicating whether C<sv> is derived from the
124123
specified class I<at the C level>. To check derivation at the Perl level, call
125124
C<isa()> as a normal Perl method.
126125
127-
In C<sv_derived_from_hv>, the class name is C<HvNAME(hv)> (which would
128-
presumably represent a stash). Its UTF8ness is C<HvNAMEUTF8(hv)>.
126+
The differences between the forms is how the class is specified, and the
127+
UTF-8ness of its name.
129128
130-
In C<sv_derived_from> and C<sv_derived_from_pv>, the class name is given by
131-
C<name>, which is a NUL-terminated C string. In C<sv_derived_from>, the name
132-
is never considered to be encoded as UTF-8.
129+
In C<sv_derived_from_sv>, the class name is extracted from C<namesv> using
130+
some version of L</C<SvPV>>. This is the preferred form. The class name is
131+
considered to be in UTF-8 iff C<namesv> is marked as such, hence C<flags> is
132+
effectively currently ignored.
133133
134-
The remaining forms differ only in how the class name is specified;
135-
they all have a C<flags> parameter. Currently, the only significant value for
136-
which is C<SVf_UTF8> to indicate that the class name is encoded as such.
134+
In C<sv_derived_from_hv>, the class name is C<HvNAME(hv)> (which would
135+
presumably represent a stash). Its UTF8ness is C<HvNAMEUTF8(hv)>.
137136
138-
In C<sv_derived_from_sv>, the class name is extracted from C<namesv>.
139-
This is the preferred form. The class name is considered to be in UTF-8 if
140-
C<namesv> is marked as such.
137+
In the remaining forms, the class name is specified by the C<name> parameter.
138+
In C<sv_derived_from> and C<sv_derived_from_pv>, it is a NUL-terminated C
139+
string. In C<sv_derived_from_pvn>, C<name> points to the first byte of the
140+
string specifying the class, and an additional parameter, C<len>, specifies
141+
its length in bytes. Hence, C<name> may contain embedded-NUL characters.
141142
142-
In C<sv_derived_from_pvn>, C<len> gives the length of C<name>, so the latter
143-
may contain embedded NUL characters.
143+
C<name> is never considered to be encoded as UTF-8 in C<sv_derived_from>. The
144+
remaining forms have a C<flags> parameter. If the C<SVf_UTF8> is set in it,
145+
the class name is encoded as UTF-8; otherwise not. No other flags are
146+
currently meaningful.
144147
145148
=cut
146149

0 commit comments

Comments
 (0)