In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/e8db349f5c61708301fd5463e49bfe95c448dd6d?hp=3fb29f095e0816412390156497a1c575873a14f5>
- Log ----------------------------------------------------------------- commit e8db349f5c61708301fd5463e49bfe95c448dd6d Author: James E Keenan <jkee...@cpan.org> Date: Fri Nov 30 10:33:07 2018 -0500 If comparison is always true, while (1) should suffice. Per suggestion by Dave Mitchell in RT 133703, re-implemented in RT 133744. ----------------------------------------------------------------------- Summary of changes: sv.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sv.c b/sv.c index ad238cdb3b..b3c402441a 100644 --- a/sv.c +++ b/sv.c @@ -8535,18 +8535,19 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO *const fp, I32 append) * null assign is a placeholder. */ rslast = rslen ? rsptr[rslen - 1] : '\0'; - if (rspara) { /* have to do this both before and after */ - do { /* to make sure file boundaries work right */ - if (PerlIO_eof(fp)) - return 0; - i = PerlIO_getc(fp); - if (i != '\n') { - if (i == -1) - return 0; - PerlIO_ungetc(fp,i); - break; - } - } while (i != EOF); + if (rspara) { /* have to do this both before and after */ + /* to make sure file boundaries work right */ + while (1) { + if (PerlIO_eof(fp)) + return 0; + i = PerlIO_getc(fp); + if (i != '\n') { + if (i == -1) + return 0; + PerlIO_ungetc(fp,i); + break; + } + } } /* See if we know enough about I/O mechanism to cheat it ! */ -- Perl5 Master Repository