From 13dc9989e55acd863329057e268c87a3f6f53aab Mon Sep 17 00:00:00 2001 From: Lukas Mai Date: Wed, 29 Mar 2023 23:42:49 +0200 Subject: op.c: remove unneeded variable `is_module_install_hack` is a local variable in S_process_special_blocks that is only used to silently treat INIT blocks (in package Module::Install::DSL) as BEGIN blocks. But instead of setting the variable and jumping before the `if` block that checks the variable, we can just jump into the block and get rid of the variable. --- op.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'op.c') diff --git a/op.c b/op.c index 4f692fd8b3..981bb2961d 100644 --- a/op.c +++ b/op.c @@ -11037,19 +11037,18 @@ S_process_special_blocks(pTHX_ I32 floor, const char *const fullname, { const char *const colon = strrchr(fullname,':'); const char *const name = colon ? colon + 1 : fullname; - int is_module_install_hack = 0; PERL_ARGS_ASSERT_PROCESS_SPECIAL_BLOCKS; if (*name == 'B') { - module_install_hack: - if (strEQ(name, "BEGIN") || is_module_install_hack) { + if (strEQ(name, "BEGIN")) { + /* can't goto a declaration, but a null statement is fine */ + module_install_hack: ; const I32 oldscope = PL_scopestack_ix; SV *max_nest_sv = NULL; IV max_nest_iv; dSP; (void)CvGV(cv); - is_module_install_hack = 0; if (floor) LEAVE_SCOPE(floor); ENTER; @@ -11197,7 +11196,6 @@ S_process_special_blocks(pTHX_ I32 floor, const char *const fullname, */ Perl_warn(aTHX_ "Treating %s::INIT block as BEGIN block as workaround", MI_INIT_WORKAROUND_PACK); - is_module_install_hack = 1; goto module_install_hack; } -- cgit v1.2.1