Use Vector::SubVector instead of using the constructor.

Review URL: http://codereview.chromium.org/4148003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5708 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
floitschV8@gmail.com 2010-10-26 13:30:31 +00:00
parent 9640b6d9ab
commit 83f0be364e

View File

@ -125,20 +125,20 @@ static double old_strtod(Vector<const char> buffer, int exponent) {
static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) { static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) {
for (int i = 0; i < buffer.length(); i++) { for (int i = 0; i < buffer.length(); i++) {
if (buffer[i] != '0') { if (buffer[i] != '0') {
return Vector<const char>(buffer.start() + i, buffer.length() - i); return buffer.SubVector(i, buffer.length());
} }
} }
return Vector<const char>(buffer.start(), 0); return buffer.SubVector(0, 0);
} }
static Vector<const char> TrimTrailingZeros(Vector<const char> buffer) { static Vector<const char> TrimTrailingZeros(Vector<const char> buffer) {
for (int i = buffer.length() - 1; i >= 0; --i) { for (int i = buffer.length() - 1; i >= 0; --i) {
if (buffer[i] != '0') { if (buffer[i] != '0') {
return Vector<const char>(buffer.start(), i + 1); return buffer.SubVector(0, i + 1);
} }
} }
return Vector<const char>(buffer.start(), 0); return buffer.SubVector(0, 0);
} }