Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(650)

Unified Diff: third_party/WebKit/Source/wtf/Vector.h

Issue 1370933002: Return early for vec.remove(position, 0). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unit test Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/VectorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/Vector.h
diff --git a/third_party/WebKit/Source/wtf/Vector.h b/third_party/WebKit/Source/wtf/Vector.h
index 972c7377f9684de030b9897ff193694777ae002d..25035266cc2d5ab1ef8e1738a799cff0566ca283 100644
--- a/third_party/WebKit/Source/wtf/Vector.h
+++ b/third_party/WebKit/Source/wtf/Vector.h
@@ -1264,6 +1264,8 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
inline void Vector<T, inlineCapacity, Allocator>::remove(size_t position, size_t length)
{
ASSERT_WITH_SECURITY_IMPLICATION(position <= size());
+ if (!length)
+ return;
RELEASE_ASSERT(position + length <= size());
T* beginSpot = begin() + position;
T* endSpot = beginSpot + length;
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/VectorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698