Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.9k stars 540 forks source link

Define and use typed xvREFCNT_inc() macros #22416

Closed leonerd closed 1 month ago

leonerd commented 1 month ago

These new macros take and return pointers to specific subtypes of SV, rather than the generic SvREFCNT_inc() family. As such they avoid needing to cast the result back.

This results in neater, easier-to-read code in a variety of places. It removes many entirely-redundant calls to the MUTABLE_xV macro. It also leaves a space for possible future expansion later on by having the macros additionally assert on the SvTYPE in -DDEBUGGING builds.

leonerd commented 1 month ago

force-pushed to squash all the commits into one, and give them a better commit message