Skip to content

Commit 407c99c

Browse files
committed
pp.h: Use STATIC_ASSERT_EXPR on SETs
This makes sure that the argument whose pointer is being passed has the correct size to be settable by the called element.
1 parent 103450b commit 407c99c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ Does not use C<TARG>. See also C<L</XPUSHu>>, C<L</mPUSHu>> and C<L</PUSHu>>.
580580
#define mXPUSHi(i) STMT_START { EXTEND(sp,1); mPUSHi(i); } STMT_END
581581
#define mXPUSHu(u) STMT_START { EXTEND(sp,1); mPUSHu(u); } STMT_END
582582

583-
#define SETs(s) (*sp = s)
583+
#define SETs(s) (STATIC_ASSERT_EXPR(sizeof(*sp) == sizeof(s)), *sp = s)
584584
#define SETTARG STMT_START { SvSETMAGIC(TARG); SETs(TARG); } STMT_END
585585
#define SETp(p,l) STMT_START { sv_setpvn(TARG, (p), (l)); SETTARG; } STMT_END
586586
#define SETn(n) STMT_START { TARGn(n,1); SETs(TARG); } STMT_END

0 commit comments

Comments
 (0)