In Perl_sv_gets(), shortbuffered is always 0 when rslen is 0.
authorNicholas Clark <nick@ccl4.org>
Mon, 29 Nov 2010 14:13:03 +0000 (14:13 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 29 Nov 2010 14:15:07 +0000 (14:15 +0000)
Hence we can jump past the test C<if (shortbuffered)> after the "this screams
louder" block, as that is only reached where rslen is 0.

sv.c

diff --git a/sv.c b/sv.c
index 5adefc6..3c97b80 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -7600,6 +7600,8 @@ Perl_sv_gets(pTHX_ register SV *const sv, register PerlIO *const fp, I32 append)
                bp += cnt;                           /* screams  |  dust */
                ptr += cnt;                          /* louder   |  sed :-) */
                cnt = 0;
+               assert (!shortbuffered);
+               goto cannot_be_shortbuffered;
            }
        }
        
@@ -7613,6 +7615,7 @@ Perl_sv_gets(pTHX_ register SV *const sv, register PerlIO *const fp, I32 append)
            continue;
        }
 
+    cannot_be_shortbuffered:
        DEBUG_P(PerlIO_printf(Perl_debug_log,
                              "Screamer: going to getc, ptr=%"UVuf", cnt=%ld\n",
                              PTR2UV(ptr),(long)cnt));