Add a flag G_WANT, as a mask for the bits G_SCALAR, G_ARRAY and G_VOID.
Nicholas Clark [Mon, 21 Jan 2008 08:54:25 +0000 (08:54 +0000)]
p4raw-id: //depot/perl@33021

cop.h
perl.c

diff --git a/cop.h b/cop.h
index 4dbc197..641fb66 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -740,6 +740,7 @@ L<perlcall>.
 #define G_SCALAR       0
 #define G_ARRAY                1
 #define G_VOID         128     /* skip this bit when adding flags below */
+#define G_WANT         (128|1)
 
 /* extra flags for Perl_call_* routines */
 #define G_DISCARD      2       /* Call FREETMPS.
diff --git a/perl.c b/perl.c
index 11c316c..7dc6d14 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -2650,7 +2650,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
                goto redo_body;
            }
            PL_stack_sp = PL_stack_base + oldmark;
-           if (flags & G_ARRAY)
+           if ((flags & G_WANT) == G_ARRAY)
                retval = 0;
            else {
                retval = 1;
@@ -2749,7 +2749,7 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags)
            goto redo_body;
        }
        PL_stack_sp = PL_stack_base + oldmark;
-       if (flags & G_ARRAY)
+       if ((flags & G_WANT) == G_ARRAY)
            retval = 0;
        else {
            retval = 1;