This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [5.8] Change 33727 (op.c) breaks constant folding in "elsif"
[perl5.git] / util.c
diff --git a/util.c b/util.c
index a6b5c1c..18d3ed3 100644 (file)
--- a/util.c
+++ b/util.c
@@ -440,9 +440,9 @@ Perl_ninstr(pTHX_ const char *big, const char *bigend, const char *little, const
     if (little >= lend)
         return (char*)big;
     {
-        const char first = *little++;
+        const char first = *little;
         const char *s, *x;
-        bigend -= lend - little;
+        bigend -= lend - little++;
     OUTER:
         while (big <= bigend) {
             if (*big++ == first) {
@@ -4814,21 +4814,28 @@ the original version contained 1 or more dots, respectively
 SV *
 Perl_vstringify(pTHX_ SV *vs)
 {
-    SV *pv;
-
     PERL_ARGS_ASSERT_VSTRINGIFY;
 
     if ( SvROK(vs) )
        vs = SvRV(vs);
-    
+
     if ( !vverify(vs) )
        Perl_croak(aTHX_ "Invalid version object");
 
-    pv = *hv_fetchs((HV*)vs, "original", FALSE);
-    if ( SvPOK(pv) ) 
-       return newSVsv(pv);
-    else
-       return &PL_sv_undef;
+    if (hv_exists((HV*)vs, "original",  sizeof("original") - 1)) {
+       SV *pv;
+       pv = *hv_fetchs((HV*)vs, "original", FALSE);
+       if ( SvPOK(pv) )
+           return newSVsv(pv);
+       else
+           return &PL_sv_undef;
+    }
+    else {
+       if ( hv_exists((HV *)vs, "qv", 2) )
+           return vnormal(vs);
+       else
+           return vnumify(vs);
+    }
 }
 
 /*