Skip to content

Commit bbd7a0f

Browse files
committed
doio: fix shmio args assert
PERL_ARGS_ASSERT_DO_SHMIO is equivalent to `assert(mark); assert(sp)`. There is no point in checking pointers that have already been dereferenced by previous statements. An optimizing compiler will simply remove those asserts as no-ops. Move the asserts up to before any of the function arguments are used.
1 parent 61bacb9 commit bbd7a0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3356,16 +3356,16 @@ I32
33563356
Perl_do_shmio(pTHX_ I32 optype, SV **mark, SV **sp)
33573357
{
33583358
#ifdef HAS_SHM
3359+
PERL_ARGS_ASSERT_DO_SHMIO;
3360+
PERL_UNUSED_ARG(sp);
3361+
33593362
char *shm;
33603363
struct shmid_ds shmds;
33613364
const I32 id = SvIVx(*++mark);
33623365
SV * const mstr = *++mark;
33633366
const I32 mpos = SvIVx(*++mark);
33643367
const I32 msize = SvIVx(*++mark);
33653368

3366-
PERL_ARGS_ASSERT_DO_SHMIO;
3367-
PERL_UNUSED_ARG(sp);
3368-
33693369
SETERRNO(0,0);
33703370
if (shmctl(id, IPC_STAT, &shmds) == -1)
33713371
return -1;

0 commit comments

Comments
 (0)