Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index 8f6e384c1a5fee8919de1052060597e056bb5a25..66f336c9c4e25e0257687639437dd2c2d437d430 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -42,6 +42,13 @@ |
#ifdef V8_SHARED |
#include <assert.h> |
+#endif // V8_SHARED |
+ |
+#ifndef V8_SHARED |
+#include <algorithm> |
+#endif // !V8_SHARED |
+ |
+#ifdef V8_SHARED |
#include "../include/v8-testing.h" |
#endif // V8_SHARED |
@@ -1360,9 +1367,8 @@ struct CounterAndKey { |
}; |
-int CompareKeys(const void* a, const void* b) { |
- return strcmp(static_cast<const CounterAndKey*>(a)->key, |
- static_cast<const CounterAndKey*>(b)->key); |
+inline bool operator<(const CounterAndKey& lhs, const CounterAndKey& rhs) { |
+ return strcmp(lhs.key, rhs.key) < 0; |
} |
#endif // V8_SHARED |
@@ -1382,7 +1388,7 @@ void Shell::OnExit() { |
counters[j].counter = i.CurrentValue(); |
counters[j].key = i.CurrentKey(); |
} |
- qsort(counters, number_of_counters, sizeof(counters[0]), CompareKeys); |
+ std::sort(counters, counters + number_of_counters); |
printf("+----------------------------------------------------------------+" |
"-------------+\n"); |
printf("| Name |" |