summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2017-02-01 13:15:00 -0700
committerKarl Williamson <khw@cpan.org>2017-02-01 20:45:08 -0700
commitc9470cf1abc4cc21f63ba5222f7860ec1175adfc (patch)
treef28dbf2eea18c8d7c77435f4aade0bf263b4447d /proto.h
parent720a74f8122cba995eee9ee7761fcc3275387435 (diff)
downloadperl-c9470cf1abc4cc21f63ba5222f7860ec1175adfc.tar.gz
toke.c: Remove unused param from static function
Commit d2067945159644d284f8064efbd41024f9e8448a reverted commit b5248d1e210c2a723adae8e9b7f5d17076647431. b5248 removed a parameter from S_scan_ident, and changed its interior to use PL_bufend instead of that parameter. The parameter had been used to limit how far into the string being parsed scan_ident could look. In all calls to scan_ident but one, the parameter was already PL_bufend. In the one call where it wasn't, b5248 compensated by temporarily changing PL_bufend around the call, running afoul, eventually, of the expectation that PL_bufend points to a NUL. I would have expected the reversion to add back both the parameter and the uses of it, but apparently the function interior has changed enough since the original commit, that it didn't even think there were conflicts. As a result the parameter got added back, but not the uses of it. I tried both approaches to fix this: 1) to change the function to use the parameter; 2) to simply delete the parameter. Only the latter passed the test suite without error. I then tried to understand why the parameter in the first place, and why the kludge introduced by b5248 to work around removing it. It appears to me that this is for the benefit of the intuit_more function to enable it to discern $] from a $ ending a bracketed character class, by ending the scan before the ']' when in a pattern. The trouble is that modern scan_ident versions do not view themselves as constrained by PL_bufend. If that is reached at a point where white space is allowed, it will try appending the next input line and continuing, thus changing PL_bufend. Thus the kludge in b5248 wouldn't necessarily do the expected limiting anyway. The reason the approach "1)" I tried didn't work was that the function continued to use the original value, even after it had read in new things, instead of accounting for those. Hence approach "2)" is used. I'm a little nervous about this, as it may lead to intuit_more() (which uses heuristics) having more cases where it makes the wrong choice about $] vs [...$]. But I don't see a way around this, and the pre-existing code could fail anyway. Spotted by Dave Mitchell.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/proto.h b/proto.h
index 46556eec17..7ec784981a 100644
--- a/proto.h
+++ b/proto.h
@@ -5552,9 +5552,9 @@ STATIC char* S_scan_heredoc(pTHX_ char *s)
#define PERL_ARGS_ASSERT_SCAN_HEREDOC \
assert(s)
-STATIC char* S_scan_ident(pTHX_ char *s, const char *send, char *dest, STRLEN destlen, I32 ck_uni);
+STATIC char* S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni);
#define PERL_ARGS_ASSERT_SCAN_IDENT \
- assert(s); assert(send); assert(dest)
+ assert(s); assert(dest)
STATIC char* S_scan_inputsymbol(pTHX_ char *start)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_SCAN_INPUTSYMBOL \