From: Nicholas Clark <nick@ccl4.org>
Date: Mon, 21 Jan 2008 08:23:46 +0000 (+0000)
Subject: Encode the G_* to OPf_WANT_* transform, the reverse of OP_GIMME(), in
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4f9115300b43ef6b5f7a27ee5faa266cbbca1243;p=p5sagit%2Fp5-mst-13.2.git

Encode the G_* to OPf_WANT_* transform, the reverse of OP_GIMME(), in
a macro OP_GIMME_REVERSE() [so that it could be changed].

p4raw-id: //depot/perl@33020
---

diff --git a/op.h b/op.h
index 7262afe..fa1230d 100644
--- a/op.h
+++ b/op.h
@@ -70,6 +70,11 @@
 	 ((op)->op_flags & OPf_WANT) == OPf_WANT_LIST   ? G_ARRAY   : \
 	 dfl)
 
+#define OP_GIMME_REVERSE(flags)			\
+	((flags & G_VOID) ? OPf_WANT_VOID :	\
+	(flags & G_ARRAY) ? OPf_WANT_LIST :	\
+			    OPf_WANT_SCALAR)
+
 /*
 =head1 "Gimme" Values
 
diff --git a/perl.c b/perl.c
index 246412a..11c316c 100644
--- a/perl.c
+++ b/perl.c
@@ -2583,9 +2583,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
     myop.op_next = NULL;
     if (!(flags & G_NOARGS))
 	myop.op_flags |= OPf_STACKED;
-    myop.op_flags |= ((flags & G_VOID) ? OPf_WANT_VOID :
-		      (flags & G_ARRAY) ? OPf_WANT_LIST :
-		      OPf_WANT_SCALAR);
+    myop.op_flags |= OP_GIMME_REVERSE(flags);
     SAVEOP();
     PL_op = (OP*)&myop;
 
@@ -2715,9 +2713,7 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags)
 	myop.op_flags = OPf_STACKED;
     myop.op_next = NULL;
     myop.op_type = OP_ENTEREVAL;
-    myop.op_flags |= ((flags & G_VOID) ? OPf_WANT_VOID :
-		      (flags & G_ARRAY) ? OPf_WANT_LIST :
-		      OPf_WANT_SCALAR);
+    myop.op_flags |= OP_GIMME_REVERSE(flags);
     if (flags & G_KEEPERR)
 	myop.op_flags |= OPf_SPECIAL;