Skip to content

Commit 7c0e048

Browse files
committed
perlapi: Combine all forms of Sv[INU] into one entry each
This makes perlapi more compact, and at the same time, easier for readers to compare them and decide which form is best suited for their purposes.
1 parent 09f72b5 commit 7c0e048

File tree

2 files changed

+44
-39
lines changed

2 files changed

+44
-39
lines changed

sv.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -886,21 +886,6 @@ Unsets the RV status of an SV.
886886
=for apidoc Am|SV*|SvRV|SV* sv
887887
Dereferences an RV to return the SV.
888888
889-
=for apidoc Am|IV|SvIVX|SV* sv
890-
Returns the raw value in the SV's IV slot, without checks or conversions.
891-
Only use when you are sure C<SvIOK> is true. See also C<L</SvIV>>.
892-
893-
=for apidoc Am|UV|SvUVX|SV* sv
894-
Returns the raw value in the SV's UV slot, without checks or conversions.
895-
Only use when you are sure C<SvUOK> is true. See also C<L</SvUV>>.
896-
897-
=for apidoc AmD|UV|SvUVXx|SV* sv
898-
This is an unnecessary synonym for L</SvUVX>
899-
900-
=for apidoc Am|NV|SvNVX|SV* sv
901-
Returns the raw value in the SV's NV slot, without checks or conversions.
902-
Only use when you are sure C<SvNOK> is true. See also C<L</SvNV>>.
903-
904889
=for apidoc Am |char* |SvPVX|SV* sv
905890
=for apidoc_item |const char*|SvPVX_const|SV* sv
906891
=for apidoc_item |char* |SvPVX_mutable|SV* sv

sv_inline.h

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -773,45 +773,65 @@ Perl_SvPADSTALE_off(SV *sv)
773773
=for apidoc SvIV
774774
=for apidoc_item SvIV_nomg
775775
=for apidoc_item m||SvIVx
776+
=for apidoc_item m||SvIVX
777+
=for apidoc_item m||SvIVXx
776778
777-
These each coerce the given SV to IV and return it. The returned value in many
778-
circumstances will get stored in C<sv>'s IV slot, but not in all cases. (Use
779-
C<L</sv_setiv>> to make sure it does).
779+
These each return the IV contained in the given SV.
780780
781-
As of 5.37.1, all are guaranteed to evaluate C<sv> only once.
781+
C<SvIVX> returns the raw value in the SV's IV slot, without checks or
782+
conversions. Only use when you are sure C<SvIOK> is true.
783+
C<SvIVXx> is a synonym for C<SvIVX>.
782784
783-
C<SvIVx> is now identical to C<SvIV>, but prior to 5.37.1, it was the only form
784-
guaranteed to evaluate C<sv> only once.
785+
In the other forms, conversions may be performed to yield a IV. The returned
786+
value in many circumstances will get stored in C<sv>'s IV slot, but not in all
787+
cases. (Use C<L</sv_setiv>> to make sure it does).
788+
All forms except C<SvIVX> now behave identically, except C<SvIV_nomg> does not
789+
perform 'get_magic'.
785790
786-
C<SvIV_nomg> is the same as C<SvIV>, but does not perform 'get' magic.
791+
As of 5.37.1, all are guaranteed to evaluate C<sv> only once. (Prior to
792+
5.37.1, C<SvIVx> was the only form guaranteed to evaluate C<sv> only once.)
787793
788794
=for apidoc SvNV
789795
=for apidoc_item SvNV_nomg
790-
=for apidoc_item m||SvNVx
796+
=for apidoc_item m ||SvNVx
797+
=for apidoc_item m ||SvNVX
798+
=for apidoc_item m||SvNVXx
791799
792-
These each coerce the given SV to NV and return it. The returned value in many
793-
circumstances will get stored in C<sv>'s NV slot, but not in all cases. (Use
794-
C<L</sv_setnv>> to make sure it does).
800+
These each return the NV contained in the given SV.
795801
796-
As of 5.37.1, all are guaranteed to evaluate C<sv> only once.
802+
C<SvNVX> returns the raw value in the SV's NV slot, without checks or
803+
conversions. Only use when you are sure C<SvNOK> is true.
804+
C<SvNVXx> is a synonym for C<SvNVX>.
797805
798-
C<SvNVx> is now identical to C<SvNV>, but prior to 5.37.1, it was the only form
799-
guaranteed to evaluate C<sv> only once.
806+
In the other forms, conversions may be performed to yield a NV. The returned
807+
value in many circumstances will get stored in C<sv>'s NV slot, but not in all
808+
cases. (Use C<L</sv_setnv>> to make sure it does).
809+
All forms except C<SvNVX> now behave identically, except C<SvNV_nomg> does not
810+
perform 'get_magic'.
800811
801-
C<SvNV_nomg> is the same as C<SvNV>, but does not perform 'get' magic.
812+
As of 5.37.1, all are guaranteed to evaluate C<sv> only once. (Prior to
813+
5.37.1, C<SvNVx> was the only form guaranteed to evaluate C<sv> only once.)
802814
803-
=for apidoc SvUV
804-
=for apidoc_item SvUV_nomg
805-
=for apidoc_item m||SvUVx
815+
=for apidoc SvUV
816+
=for apidoc_item SvUV_nomg
817+
=for apidoc_item m||SvUVx
818+
=for apidoc_item m||SvUVX
819+
=for apidoc_item m||SvUVXx
806820
807-
These each coerce the given SV to UV and return it. The returned value in many
808-
circumstances will get stored in C<sv>'s UV slot, but not in all cases. (Use
809-
C<L</sv_setuv>> to make sure it does).
821+
These each return the UV contained in the given SV.
810822
811-
As of 5.37.1, all are guaranteed to evaluate C<sv> only once.
823+
C<SvUVX> returns the raw value in the SV's UV slot, without checks or
824+
conversions. Only use when you are sure C<SvUOK> is true.
825+
C<SvUVXx> is a synonym for C<SvUVX>.
812826
813-
C<SvUVx> is now identical to C<SvUV>, but prior to 5.37.1, it was the only form
814-
guaranteed to evaluate C<sv> only once.
827+
In the other forms, conversions may be performed to yield a UV. The returned
828+
value in many circumstances will get stored in C<sv>'s UV slot, but not in all
829+
cases. (Use C<L</sv_setuv>> to make sure it does).
830+
All forms except C<SvUVX> now behave identically, except C<SvUV_nomg> does not
831+
perform 'get_magic'.
832+
833+
As of 5.37.1, all are guaranteed to evaluate C<sv> only once. (Prior to
834+
5.37.1, C<SvUVx> was the only form guaranteed to evaluate C<sv> only once.)
815835
816836
=cut
817837
*/

0 commit comments

Comments
 (0)