summaryrefslogtreecommitdiff
path: root/dquote.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-11-23 15:00:55 -0700
committerKarl Williamson <khw@cpan.org>2015-11-25 15:48:17 -0700
commitb67fd2c557cdf9bdc899813a5e4f2dee22e4f63e (patch)
tree055007b23413908232464966d3435a702fb4424a /dquote.c
parent1d1c12d9a3f5f51cb9639329ae0b854f2dab7b05 (diff)
downloadperl-b67fd2c557cdf9bdc899813a5e4f2dee22e4f63e.tar.gz
toke.c: Remove soon-to-be invalid t assumption
The code in toke.c assumes that the UTF8 expansion of the string "\x{foo}" takes no more bytes than the original input text, which includes the 4 bytes of overhead "\x{}". Similarly for "\o{}". The functions that convert to the code point actually now assert for this. The next commit will make this assumption definitely invalid on EBCDIC platforms. Remove the assertions, and actually handle the case properly. The other places that call the conversion functions do not make this assumption, so there is no harm in removing them from there. Since we believe that this can't happen except on EBCDIC, we could #ifdef this code and use just an assert on non-EBCDIC. But it's easier to maintain if #ifdef's are minimized. Parsing is not a time-critical operation, like being in an inner loop, and the extra test gives a branch prediction hint to the compiler.
Diffstat (limited to 'dquote.c')
-rw-r--r--dquote.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/dquote.c b/dquote.c
index 42864d4dad..895f17dc9d 100644
--- a/dquote.c
+++ b/dquote.c
@@ -158,10 +158,6 @@ Perl_grok_bslash_o(pTHX_ char **s, UV *uv, const char** error_msg,
/* Return past the '}' */
*s = e + 1;
- /* guarantee replacing "\o{...}" with utf8 bytes fits within
- * existing space */
- assert(UVCHR_SKIP(*uv) < *s - start);
-
return TRUE;
}