From: Nicholas Clark Date: Wed, 21 Oct 2009 20:40:06 +0000 (+0100) Subject: Remove the PERLIO * argument to S_filter_gets(), as it's always PL_rsfp X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5cc814fd5c2c076b31431eb7a8f9e17719c5baae;p=p5sagit%2Fp5-mst-13.2.git Remove the PERLIO * argument to S_filter_gets(), as it's always PL_rsfp Conceptually it's also wrong, as if there are source filters, the passed-in file handle is not passed up the stack of filters for the topmost filter to use to read from. It was in the parameter list from the first creation of filter_gets() in 16d20bd98cd29be76029ebf04027a7edd34d817b, when calls to sv_gets() were replaced by it. --- diff --git a/embed.fnc b/embed.fnc index 0b0dd43..634d482 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1813,7 +1813,7 @@ s |void |no_op |NN const char *const what|NULLOK char *s sR |I32 |sublex_done sR |I32 |sublex_push sR |I32 |sublex_start -sR |char * |filter_gets |NN SV *sv|NN PerlIO *fp|STRLEN append +sR |char * |filter_gets |NN SV *sv|STRLEN append sR |HV * |find_in_my_stash|NN const char *pkgname|STRLEN len sR |char * |tokenize_use |int is_use|NN char *s so |SV* |new_constant |NULLOK const char *s|STRLEN len \ diff --git a/embed.h b/embed.h index b3b655f..8dfbd9c 100644 --- a/embed.h +++ b/embed.h @@ -3981,7 +3981,7 @@ #define sublex_done() S_sublex_done(aTHX) #define sublex_push() S_sublex_push(aTHX) #define sublex_start() S_sublex_start(aTHX) -#define filter_gets(a,b,c) S_filter_gets(aTHX_ a,b,c) +#define filter_gets(a,b) S_filter_gets(aTHX_ a,b) #define find_in_my_stash(a,b) S_find_in_my_stash(aTHX_ a,b) #define tokenize_use(a,b) S_tokenize_use(aTHX_ a,b) #define deprecate_commaless_var_list() S_deprecate_commaless_var_list(aTHX) diff --git a/proto.h b/proto.h index ca92cb9..89b48e6 100644 --- a/proto.h +++ b/proto.h @@ -5848,12 +5848,11 @@ STATIC I32 S_sublex_push(pTHX) STATIC I32 S_sublex_start(pTHX) __attribute__warn_unused_result__; -STATIC char * S_filter_gets(pTHX_ SV *sv, PerlIO *fp, STRLEN append) +STATIC char * S_filter_gets(pTHX_ SV *sv, STRLEN append) __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2); + __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_FILTER_GETS \ - assert(sv); assert(fp) + assert(sv) STATIC HV * S_find_in_my_stash(pTHX_ const char *pkgname, STRLEN len) __attribute__warn_unused_result__ diff --git a/toke.c b/toke.c index 39b2e8a..1eceeb0 100644 --- a/toke.c +++ b/toke.c @@ -1054,8 +1054,8 @@ S_skipspace(pTHX_ register char *s) curoff = s - SvPVX(PL_linestr); #endif - if ((s = filter_gets(PL_linestr, PL_rsfp, - (prevlen = SvCUR(PL_linestr)))) == NULL) + if ((s = filter_gets(PL_linestr, (prevlen = SvCUR(PL_linestr)))) + == NULL) { #ifdef PERL_MAD if (PL_madskills && curoff != startoff) { @@ -2957,7 +2957,7 @@ Perl_filter_read(pTHX_ int idx, SV *buf_sv, int maxlen) } STATIC char * -S_filter_gets(pTHX_ register SV *sv, register PerlIO *fp, STRLEN append) +S_filter_gets(pTHX_ register SV *sv, STRLEN append) { dVAR; @@ -2977,7 +2977,7 @@ S_filter_gets(pTHX_ register SV *sv, register PerlIO *fp, STRLEN append) return NULL ; } else - return (sv_gets(sv, fp, append)); + return (sv_gets(sv, PL_rsfp, append)); } STATIC HV * @@ -3740,7 +3740,7 @@ Perl_yylex(pTHX) } do { bof = PL_rsfp ? TRUE : FALSE; - if ((s = filter_gets(PL_linestr, PL_rsfp, 0)) == NULL) { + if ((s = filter_gets(PL_linestr, 0)) == NULL) { fake_eof: #ifdef PERL_MAD PL_realtokenstart = -1; @@ -5809,8 +5809,8 @@ Perl_yylex(pTHX) sv_catpvn(PL_endwhite, tstart, PL_bufend - tstart); PL_realtokenstart = -1; } - while ((s = filter_gets(PL_endwhite, PL_rsfp, - SvCUR(PL_endwhite))) != NULL) ; + while ((s = filter_gets(PL_endwhite, SvCUR(PL_endwhite))) + != NULL) ; } #endif PL_rsfp = NULL; @@ -11422,7 +11422,8 @@ S_scan_heredoc(pTHX_ register char *s) } #endif if (!outer || - !(PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = filter_gets(PL_linestr, PL_rsfp, 0))) { + !(PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart + = filter_gets(PL_linestr, 0))) { CopLINE_set(PL_curcop, (line_t)PL_multi_start); missingterm(PL_tokenbuf); } @@ -11934,7 +11935,8 @@ S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims) } #endif if (!PL_rsfp || - !(PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = filter_gets(PL_linestr, PL_rsfp, 0))) { + !(PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart + = filter_gets(PL_linestr, 0))) { sv_free(sv); CopLINE_set(PL_curcop, (line_t)PL_multi_start); return NULL; @@ -12485,7 +12487,7 @@ S_scan_formline(pTHX_ register char *s) PL_thistoken = newSVpvn(tokenstart, PL_bufend - tokenstart); } #endif - s = filter_gets(PL_linestr, PL_rsfp, 0); + s = filter_gets(PL_linestr, 0); #ifdef PERL_MAD tokenstart = PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(PL_linestr); #else