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

Unified Diff: src/list-inl.h

Issue 12427: Merge regexp2000 back into bleeding_edge (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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
Index: src/list-inl.h
===================================================================
--- src/list-inl.h (revision 830)
+++ src/list-inl.h (working copy)
@@ -90,11 +90,18 @@
template<typename T, class P>
+bool List<T, P>::Contains(const T& elm) {
+ for (int i = 0; i < length_; i++) {
+ if (data_[i] == elm)
+ return true;
+ }
+ return false;
+}
+
+
+template<typename T, class P>
void List<T, P>::Sort(int (*cmp)(const T* x, const T* y)) {
- qsort(data_,
- length_,
- sizeof(T),
- reinterpret_cast<int (*)(const void*, const void*)>(cmp));
+ ToVector().Sort(cmp);
#ifdef DEBUG
for (int i = 1; i < length_; i++)
ASSERT(cmp(&data_[i - 1], &data_[i]) <= 0);
@@ -103,6 +110,12 @@
template<typename T, class P>
+void List<T, P>::Sort() {
+ Sort(PointerSpaceship<T>);
+}
+
+
+template<typename T, class P>
void List<T, P>::Initialize(int capacity) {
ASSERT(capacity >= 0);
data_ = (capacity > 0) ? NewData(capacity) : NULL;

Powered by Google App Engine
This is Rietveld 408576698