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

Unified Diff: src/list-inl.h

Issue 10682: Inverted character classes (Closed)
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
diff --git a/src/list-inl.h b/src/list-inl.h
index eeb580323f36700fc812997dd455032f6fcb5c08..80094fbdca863a7d67b1da3acd42079f7605e5f9 100644
--- a/src/list-inl.h
+++ b/src/list-inl.h
@@ -101,10 +101,7 @@ bool List<T, P>::Contains(const T& elm) {
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);
@@ -113,6 +110,12 @@ void List<T, P>::Sort(int (*cmp)(const T* x, const T* y)) {
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