This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In pp_getlogin, use sv_setpv_mg() to avoid needing an explicit strlen() call.
authorNicholas Clark <nick@ccl4.org>
Sun, 24 Oct 2010 08:59:08 +0000 (09:59 +0100)
committerNicholas Clark <nick@ccl4.org>
Sun, 24 Oct 2010 08:59:08 +0000 (09:59 +0100)
It was using PUSHp() here, meaning local object code for a call to strlen(),
and for SvSETMAGIC().

pp_sys.c

index ed4ec13..39daad6 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -5517,7 +5517,8 @@ PP(pp_getlogin)
     EXTEND(SP, 1);
     if (!(tmps = PerlProc_getlogin()))
        RETPUSHUNDEF;
-    PUSHp(tmps, strlen(tmps));
+    sv_setpv_mg(TARG, tmps);
+    PUSHs(TARG);
     RETURN;
 #else
     DIE(aTHX_ PL_no_func, "getlogin");