summaryrefslogtreecommitdiffstats
path: root/base/string_piece.h
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-05-31 20:30:28 +0100
committerKristian Monsen <kristianm@google.com>2011-06-14 20:31:41 -0700
commit72a454cd3513ac24fbdd0e0cb9ad70b86a99b801 (patch)
tree382278a54ce7a744d62fa510a9a80688cc12434b /base/string_piece.h
parentc4becdd46e31d261b930e4b5a539cbc1d45c23a6 (diff)
downloadexternal_chromium-72a454cd3513ac24fbdd0e0cb9ad70b86a99b801.zip
external_chromium-72a454cd3513ac24fbdd0e0cb9ad70b86a99b801.tar.gz
external_chromium-72a454cd3513ac24fbdd0e0cb9ad70b86a99b801.tar.bz2
Merge Chromium.org at r11.0.672.0: Initial merge by git.
Change-Id: I8b4aaf611a2a405fe3fe10e8a94ea7658645c192
Diffstat (limited to 'base/string_piece.h')
-rw-r--r--base/string_piece.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/base/string_piece.h b/base/string_piece.h
index 80c6cab..64326e1 100644
--- a/base/string_piece.h
+++ b/base/string_piece.h
@@ -19,8 +19,6 @@
#define BASE_STRING_PIECE_H_
#pragma once
-#include <algorithm>
-#include <iosfwd>
#include <string>
#include "base/basictypes.h"
@@ -93,7 +91,8 @@ class StringPiece {
}
int compare(const StringPiece& x) const {
- int r = wordmemcmp(ptr_, x.ptr_, std::min(length_, x.length_));
+ int r = wordmemcmp(
+ ptr_, x.ptr_, (length_ < x.length_ ? length_ : x.length_));
if (r == 0) {
if (length_ < x.length_) r = -1;
else if (length_ > x.length_) r = +1;
@@ -171,8 +170,8 @@ inline bool operator!=(const StringPiece& x, const StringPiece& y) {
}
inline bool operator<(const StringPiece& x, const StringPiece& y) {
- const int r = StringPiece::wordmemcmp(x.data(), y.data(),
- std::min(x.size(), y.size()));
+ const int r = StringPiece::wordmemcmp(
+ x.data(), y.data(), (x.size() < y.size() ? x.size() : y.size()));
return ((r < 0) || ((r == 0) && (x.size() < y.size())));
}
@@ -188,9 +187,6 @@ inline bool operator>=(const StringPiece& x, const StringPiece& y) {
return !(x < y);
}
-// allow StringPiece to be logged (needed for unit testing).
-extern std::ostream& operator<<(std::ostream& o, const StringPiece& piece);
-
} // namespace base
#endif // BASE_STRING_PIECE_H_