summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorLukas Mai <lukasmai.403@gmail.com>2023-03-29 23:42:49 +0200
committerYves Orton <demerphq@gmail.com>2023-03-30 16:33:43 +0800
commit13dc9989e55acd863329057e268c87a3f6f53aab (patch)
tree25142fe286c6bf6adc02f3a45ad014089924f77d /op.c
parentd0e6e389eee3c7fbbfed5c3d42b403d94b312dde (diff)
downloadperl-13dc9989e55acd863329057e268c87a3f6f53aab.tar.gz
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.
Diffstat (limited to 'op.c')
-rw-r--r--op.c8
1 files changed, 3 insertions, 5 deletions
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;
}