From 03e44c9995ffa6bc2249c8d6acbf479a56db57f2 Mon Sep 17 00:00:00 2001 From: Gian-Carlo Pascutto Date: Mon, 24 Nov 2014 08:38:14 +0100 Subject: [PATCH] Bug 1102687 - Presize the urlclassifier PrefixSet delta array on loading. r=dmajor --- toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp index 2b24aa5b92c9..323e53e2e12a 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp @@ -300,7 +300,7 @@ nsUrlClassifierPrefixSet::LoadFromFd(AutoFDClose& fileFd) nsTArray indexStarts; indexStarts.SetLength(indexSize); mIndexPrefixes.SetLength(indexSize); - mIndexDeltas.Clear(); + mIndexDeltas.SetLength(indexSize); mTotalPrefixes = indexSize; @@ -313,7 +313,6 @@ nsUrlClassifierPrefixSet::LoadFromFd(AutoFDClose& fileFd) return NS_ERROR_FILE_CORRUPTED; } for (uint32_t i = 0; i < indexSize; i++) { - mIndexDeltas.AppendElement(); uint32_t numInDelta = i == indexSize - 1 ? deltaSize - indexStarts[i] : indexStarts[i + 1] - indexStarts[i]; if (numInDelta > 0) {