@@ -817,6 +817,8 @@ public class Tokenizer implements Locator {
|
||||
}
|
||||
|
||||
@Inline private void appendCharRefBuf(char c) {
|
||||
// CPPONLY: assert charRefBufLen < charRefBuf.length:
|
||||
// CPPONLY: "RELEASE: Attempted to overrun charRefBuf!";
|
||||
charRefBuf[charRefBufLen++] = c;
|
||||
}
|
||||
|
||||
@@ -850,7 +852,13 @@ public class Tokenizer implements Locator {
|
||||
* @param c
|
||||
* the UTF-16 code unit to append
|
||||
*/
|
||||
private void appendStrBuf(char c) {
|
||||
@Inline private void appendStrBuf(char c) {
|
||||
// CPPONLY: assert strBufLen < strBuf.length: "Previous buffer length insufficient.";
|
||||
// CPPONLY: if (strBufLen == strBuf.length) {
|
||||
// CPPONLY: if (!EnsureBufferSpace(1)) {
|
||||
// CPPONLY: assert false: "RELEASE: Unable to recover from buffer reallocation failure";
|
||||
// CPPONLY: } // TODO: Add telemetry when outer if fires but inner does not
|
||||
// CPPONLY: }
|
||||
strBuf[strBufLen++] = c;
|
||||
}
|
||||
|
||||
@@ -951,14 +959,15 @@ public class Tokenizer implements Locator {
|
||||
}
|
||||
|
||||
private void appendStrBuf(@NoLength char[] buffer, int offset, int length) {
|
||||
int reqLen = strBufLen + length;
|
||||
if (strBuf.length < reqLen) {
|
||||
char[] newBuf = new char[reqLen + (reqLen >> 1)];
|
||||
System.arraycopy(strBuf, 0, newBuf, 0, strBuf.length);
|
||||
strBuf = newBuf;
|
||||
}
|
||||
int newLen = strBufLen + length;
|
||||
// CPPONLY: assert newLen <= strBuf.length: "Previous buffer length insufficient.";
|
||||
// CPPONLY: if (strBuf.length < newLen) {
|
||||
// CPPONLY: if (!EnsureBufferSpace(length)) {
|
||||
// CPPONLY: assert false: "RELEASE: Unable to recover from buffer reallocation failure";
|
||||
// CPPONLY: } // TODO: Add telemetry when outer if fires but inner does not
|
||||
// CPPONLY: }
|
||||
System.arraycopy(buffer, offset, strBuf, strBufLen, length);
|
||||
strBufLen = reqLen;
|
||||
strBufLen = newLen;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user