This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add builtin::is_tainted
[perl5.git] / pp.c
diff --git a/pp.c b/pp.c
index 13eb068..ad0c8ad 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -7249,28 +7249,22 @@ PP(pp_cmpchain_dup)
 
 PP(pp_is_bool)
 {
-    dSP;
-    dTARGET;
-    SV *arg = POPs;
+    SV *arg = *PL_stack_sp;
 
     SvGETMAGIC(arg);
 
-    sv_setbool_mg(TARG, SvIsBOOL(arg));
-    PUSHs(TARG);
-    RETURN;
+    *PL_stack_sp = boolSV(SvIsBOOL(arg));
+    return NORMAL;
 }
 
 PP(pp_is_weak)
 {
-    dSP;
-    dTARGET;
-    SV *arg = POPs;
+    SV *arg = *PL_stack_sp;
 
     SvGETMAGIC(arg);
 
-    sv_setbool_mg(TARG, SvROK(arg) && SvWEAKREF(arg));
-    PUSHs(TARG);
-    RETURN;
+    *PL_stack_sp = boolSV(SvWEAKREF(arg));
+    return NORMAL;
 }
 
 PP(pp_weaken)
@@ -7377,6 +7371,16 @@ PP(pp_floor)
     RETURN;
 }
 
+PP(pp_is_tainted)
+{
+    SV *arg = *PL_stack_sp;
+
+    SvGETMAGIC(arg);
+
+    *PL_stack_sp = boolSV(SvTAINTED(arg));
+    return NORMAL;
+}
+
 /*
  * ex: set ts=8 sts=4 sw=4 et:
  */