From 2285a89165627eddac2a1dffe781bd00665370bc Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 18 Nov 2014 18:42:43 -0800 Subject: [PATCH] Bug 1100219 - Avoid lots of unnecessary string copying in ProtocolParser. r=neil. --- toolkit/components/url-classifier/ProtocolParser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toolkit/components/url-classifier/ProtocolParser.cpp b/toolkit/components/url-classifier/ProtocolParser.cpp index 8acc84858d86..5b77fc9a8545 100644 --- a/toolkit/components/url-classifier/ProtocolParser.cpp +++ b/toolkit/components/url-classifier/ProtocolParser.cpp @@ -284,7 +284,7 @@ ProtocolParser::ProcessChunk(bool* aDone) // Pull the chunk out of the pending stream data. nsAutoCString chunk; chunk.Assign(Substring(mPending, 0, mChunkState.length)); - mPending = Substring(mPending, mChunkState.length); + mPending.Cut(0, mChunkState.length); *aDone = false; mState = PROTOCOL_STATE_CONTROL; @@ -590,14 +590,14 @@ ProtocolParser::ProcessHostSubComplete(uint8_t aNumEntries, } bool -ProtocolParser::NextLine(nsACString& line) +ProtocolParser::NextLine(nsACString& aLine) { int32_t newline = mPending.FindChar('\n'); if (newline == kNotFound) { return false; } - line.Assign(Substring(mPending, 0, newline)); - mPending = Substring(mPending, newline + 1); + aLine.Assign(Substring(mPending, 0, newline)); + mPending.Cut(0, newline + 1); return true; }