summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-06-19 09:45:54 +0100
committerDavid Mitchell <davem@iabyn.com>2015-06-19 09:45:54 +0100
commita05700a87a1c6e3a191a8fcb99082092e4c5c6eb (patch)
tree724ace37e61f3d9dbedb60c162de66466c933ac9
parentd40dc6b141019491ca18144b6a25c03e8882ffe8 (diff)
downloadperl-a05700a87a1c6e3a191a8fcb99082092e4c5c6eb.tar.gz
sinplify Perl_block_gimme()
The switch statement was fairly pointless, as it was just a bunch of case G_VOID: return G_VOID; so replace the switch with a simple "croak if 0, otherwise return the value".
-rw-r--r--pp_ctl.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 57268935df..7f485d3df9 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1349,22 +1349,17 @@ I32
Perl_block_gimme(pTHX)
{
const I32 cxix = dopoptosub(cxstack_ix);
+ U8 gimme;
if (cxix < 0)
return G_VOID;
- switch (cxstack[cxix].blk_gimme) {
- case G_VOID:
- return G_VOID;
- case G_SCALAR:
- return G_SCALAR;
- case G_ARRAY:
- return G_ARRAY;
- default:
- Perl_croak(aTHX_ "panic: bad gimme: %d\n", cxstack[cxix].blk_gimme);
- }
- NOT_REACHED; /* NOTREACHED */
+ gimme = (cxstack[cxix].blk_gimme & G_WANT);
+ if (!gimme)
+ Perl_croak(aTHX_ "panic: bad gimme: %d\n", gimme);
+ return gimme;
}
+
I32
Perl_is_lvalue_sub(pTHX)
{