From 09f72b5b680d2b4d4b0b2f9c175d20e795c91b8b Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 15 Oct 2025 06:49:55 -0600 Subject: [PATCH 1/2] perlapi: SvUVX needs SvUOK to be true; not SvIOK I looked at the code, and SvUVX looks at the UV slot; so this is a typo --- sv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sv.h b/sv.h index 69cb8e2a99d8..12cd542188ec 100644 --- a/sv.h +++ b/sv.h @@ -892,7 +892,7 @@ Only use when you are sure C is true. See also C>. =for apidoc Am|UV|SvUVX|SV* sv Returns the raw value in the SV's UV slot, without checks or conversions. -Only use when you are sure C is true. See also C>. +Only use when you are sure C is true. See also C>. =for apidoc AmD|UV|SvUVXx|SV* sv This is an unnecessary synonym for L From 7c0e04812c9d156e139f2c273c80b94b54a40523 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 15 Oct 2025 06:51:39 -0600 Subject: [PATCH 2/2] 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. --- sv.h | 15 ------------ sv_inline.h | 68 ++++++++++++++++++++++++++++++++++------------------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/sv.h b/sv.h index 12cd542188ec..1b8e686e0e38 100644 --- a/sv.h +++ b/sv.h @@ -886,21 +886,6 @@ Unsets the RV status of an SV. =for apidoc Am|SV*|SvRV|SV* sv Dereferences an RV to return the SV. -=for apidoc Am|IV|SvIVX|SV* sv -Returns the raw value in the SV's IV slot, without checks or conversions. -Only use when you are sure C is true. See also C>. - -=for apidoc Am|UV|SvUVX|SV* sv -Returns the raw value in the SV's UV slot, without checks or conversions. -Only use when you are sure C is true. See also C>. - -=for apidoc AmD|UV|SvUVXx|SV* sv -This is an unnecessary synonym for L - -=for apidoc Am|NV|SvNVX|SV* sv -Returns the raw value in the SV's NV slot, without checks or conversions. -Only use when you are sure C is true. See also C>. - =for apidoc Am |char* |SvPVX|SV* sv =for apidoc_item |const char*|SvPVX_const|SV* sv =for apidoc_item |char* |SvPVX_mutable|SV* sv diff --git a/sv_inline.h b/sv_inline.h index df002df88815..84d2fdc055ff 100644 --- a/sv_inline.h +++ b/sv_inline.h @@ -773,45 +773,65 @@ Perl_SvPADSTALE_off(SV *sv) =for apidoc SvIV =for apidoc_item SvIV_nomg =for apidoc_item m||SvIVx +=for apidoc_item m||SvIVX +=for apidoc_item m||SvIVXx -These each coerce the given SV to IV and return it. The returned value in many -circumstances will get stored in C's IV slot, but not in all cases. (Use -C> to make sure it does). +These each return the IV contained in the given SV. -As of 5.37.1, all are guaranteed to evaluate C only once. +C returns the raw value in the SV's IV slot, without checks or +conversions. Only use when you are sure C is true. +C is a synonym for C. -C is now identical to C, but prior to 5.37.1, it was the only form -guaranteed to evaluate C only once. +In the other forms, conversions may be performed to yield a IV. The returned +value in many circumstances will get stored in C's IV slot, but not in all +cases. (Use C> to make sure it does). +All forms except C now behave identically, except C does not +perform 'get_magic'. -C is the same as C, but does not perform 'get' magic. +As of 5.37.1, all are guaranteed to evaluate C only once. (Prior to +5.37.1, C was the only form guaranteed to evaluate C only once.) =for apidoc SvNV =for apidoc_item SvNV_nomg -=for apidoc_item m||SvNVx +=for apidoc_item m ||SvNVx +=for apidoc_item m ||SvNVX +=for apidoc_item m||SvNVXx -These each coerce the given SV to NV and return it. The returned value in many -circumstances will get stored in C's NV slot, but not in all cases. (Use -C> to make sure it does). +These each return the NV contained in the given SV. -As of 5.37.1, all are guaranteed to evaluate C only once. +C returns the raw value in the SV's NV slot, without checks or +conversions. Only use when you are sure C is true. +C is a synonym for C. -C is now identical to C, but prior to 5.37.1, it was the only form -guaranteed to evaluate C only once. +In the other forms, conversions may be performed to yield a NV. The returned +value in many circumstances will get stored in C's NV slot, but not in all +cases. (Use C> to make sure it does). +All forms except C now behave identically, except C does not +perform 'get_magic'. -C is the same as C, but does not perform 'get' magic. +As of 5.37.1, all are guaranteed to evaluate C only once. (Prior to +5.37.1, C was the only form guaranteed to evaluate C only once.) -=for apidoc SvUV -=for apidoc_item SvUV_nomg -=for apidoc_item m||SvUVx +=for apidoc SvUV +=for apidoc_item SvUV_nomg +=for apidoc_item m||SvUVx +=for apidoc_item m||SvUVX +=for apidoc_item m||SvUVXx -These each coerce the given SV to UV and return it. The returned value in many -circumstances will get stored in C's UV slot, but not in all cases. (Use -C> to make sure it does). +These each return the UV contained in the given SV. -As of 5.37.1, all are guaranteed to evaluate C only once. +C returns the raw value in the SV's UV slot, without checks or +conversions. Only use when you are sure C is true. +C is a synonym for C. -C is now identical to C, but prior to 5.37.1, it was the only form -guaranteed to evaluate C only once. +In the other forms, conversions may be performed to yield a UV. The returned +value in many circumstances will get stored in C's UV slot, but not in all +cases. (Use C> to make sure it does). +All forms except C now behave identically, except C does not +perform 'get_magic'. + +As of 5.37.1, all are guaranteed to evaluate C only once. (Prior to +5.37.1, C was the only form guaranteed to evaluate C only once.) =cut */