Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sv.h: struct body_details bodies_by_type is unreadable, add more comments #22880

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion intrpvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ C<&PL_sv_undef>.

=for apidoc Amn|SV|PL_sv_no
This is the C<false> SV. It is readonly. See C<L</PL_sv_yes>>. Always refer
to this as C<&PL_sv_no>.
to this as C<&PL_sv_no>. Also see C<L</PL_sv_zero>>. That is similar except
for its string value. C<&PL_sv_no>'s string value is empty string C<"">.

=for apidoc Amn|SV|PL_sv_yes
This is the C<true> SV. It is readonly. See C<L</PL_sv_no>>. Always refer to
Expand Down
6 changes: 4 additions & 2 deletions sv_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ ALIGNED_TYPE(XPVOBJ);
STRUCT_OFFSET(type, last_member) \
+ sizeof (((type*)SvANY((const SV *)0))->last_member)

/* sz_if_arena, copy_sz, ghost_sz, SVt, !upg, NV=0; , has_arena, arena_sz */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using the actual member names would be less confusing, even if they don't have the best possible names.

static const struct body_details bodies_by_type[] = {
/* HEs use this offset for their arena. */
{ 0, 0, 0, SVt_NULL, FALSE, NONV, NOARENA, 0 },
Expand All @@ -206,7 +207,7 @@ static const struct body_details bodies_by_type[] = {
+ STRUCT_OFFSET(XPV, xpv_cur),
SVt_PV, FALSE, NONV, HASARENA,
FIT_ARENA(0, sizeof(XPV) - STRUCT_OFFSET(XPV, xpv_cur)) },

/* sz_if_arena, copy_sz, ghost_sz, SVt, !upg, NV=0; , has_arena, arena_sz */
{ sizeof(XINVLIST) - STRUCT_OFFSET(XPV, xpv_cur),
copy_length(XINVLIST, is_offset) - STRUCT_OFFSET(XPV, xpv_cur),
+ STRUCT_OFFSET(XPV, xpv_cur),
Expand Down Expand Up @@ -238,6 +239,7 @@ static const struct body_details bodies_by_type[] = {
SVt_PVNV, FALSE, HADNV, HASARENA,
FIT_ARENA(0, sizeof(XPVNV) - STRUCT_OFFSET(XPV, xpv_cur)) },
#endif
/* sz_if_arena, copy_sz, ghost_sz, SVt, !upg, NV=0; , has_arena, arena_sz */
{ sizeof(XPVMG), copy_length(XPVMG, xnv_u), 0, SVt_PVMG, FALSE, HADNV,
HASARENA, FIT_ARENA(0, sizeof(XPVMG)) },

Expand Down Expand Up @@ -271,7 +273,7 @@ static const struct body_details bodies_by_type[] = {
0,
SVt_PVCV, TRUE, NONV, HASARENA,
FIT_ARENA(0, sizeof(ALIGNED_TYPE_NAME(XPVCV))) },

/* sz_if_arena, copy_sz, ghost_sz, SVt, !upg, NV=0; , has_arena, arena_sz */
{ sizeof(ALIGNED_TYPE_NAME(XPVFM)),
sizeof(XPVFM),
0,
Expand Down
Loading