Perl_sv_chop() can return early if it's being asked to do nothing.
Nicholas Clark [Sat, 29 Dec 2007 13:33:38 +0000 (13:33 +0000)]
p4raw-id: //depot/perl@32763

sv.c

diff --git a/sv.c b/sv.c
index 3e7c3ff..913a5da 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -4211,6 +4211,10 @@ Perl_sv_chop(pTHX_ register SV *sv, register const char *ptr)
     if (!ptr || !SvPOKp(sv))
        return;
     delta = ptr - SvPVX_const(sv);
+    if (!delta) {
+       /* Nothing to do.  */
+       return;
+    }
     SV_CHECK_THINKFIRST(sv);
     if (SvTYPE(sv) < SVt_PVIV)
        sv_upgrade(sv,SVt_PVIV);