Index: base/tracked_objects.cc |
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc |
index 21ac0fcaf17e37fcec14fbe05d89b1b743aa1b62..414563a40b485dddb8edcf860c0bfcd0fbf4944d 100644 |
--- a/base/tracked_objects.cc |
+++ b/base/tracked_objects.cc |
@@ -671,8 +671,9 @@ void Aggregation::Write(std::string* output) const { |
if (birth_files_.size() > 1) { |
base::StringAppendF(output, "%" PRIuS " Files. ", birth_files_.size()); |
} else { |
- base::StringAppendF(output, "All born in %s. ", |
- birth_files_.begin()->first.c_str()); |
+ output->append("All born in "); |
+ birth_files_.begin()->first.AppendToString(output); |
+ output->append(". "); |
} |
} |
@@ -755,27 +756,30 @@ bool Comparator::operator()(const Snapshot& left, |
break; |
case BIRTH_FILE: |
- if (left.location().file_name() != right.location().file_name()) { |
- int comp = strcmp(left.location().file_name(), |
- right.location().file_name()); |
- if (comp) |
- return 0 > comp; |
+ { |
+ base::StringPiece left_file = left.location().file_name(); |
+ base::StringPiece right_file = right.location().file_name(); |
+ if (left_file != right_file) |
+ return left_file < right_file; |
} |
break; |
case BIRTH_FUNCTION: |
- if (left.location().function_name() != right.location().function_name()) { |
- int comp = strcmp(left.location().function_name(), |
- right.location().function_name()); |
- if (comp) |
- return 0 > comp; |
+ { |
+ base::StringPiece left_function = left.location().function_name(); |
+ base::StringPiece right_function = right.location().function_name(); |
+ if (left_function != right_function) |
+ return left_function < right_function; |
} |
break; |
case BIRTH_LINE: |
- if (left.location().line_number() != right.location().line_number()) |
- return left.location().line_number() < |
- right.location().line_number(); |
+ { |
+ int left_line = left.location().line_number(); |
+ int right_line = right.location().line_number(); |
+ if (left_line != right_line) |
+ return left_line < right_line; |
+ } |
break; |
case COUNT: |
@@ -819,21 +823,13 @@ bool Comparator::Equivalent(const Snapshot& left, |
break; |
case BIRTH_FILE: |
- if (left.location().file_name() != right.location().file_name()) { |
- int comp = strcmp(left.location().file_name(), |
- right.location().file_name()); |
- if (comp) |
- return false; |
- } |
+ if (left.location().file_name() != right.location().file_name()) |
+ return false; |
break; |
case BIRTH_FUNCTION: |
- if (left.location().function_name() != right.location().function_name()) { |
- int comp = strcmp(left.location().function_name(), |
- right.location().function_name()); |
- if (comp) |
- return false; |
- } |
+ if (left.location().function_name() != right.location().function_name()) |
+ return false; |
break; |
case COUNT: |
@@ -869,12 +865,14 @@ bool Comparator::Acceptable(const Snapshot& sample) const { |
break; |
case BIRTH_FILE: |
- if (!strstr(sample.location().file_name(), required_.c_str())) |
+ if (sample.location().file_name().find(required_.c_str()) == |
jar (doing other things)
2011/09/01 18:17:51
Since you have transition to passing SringPieces o
jbates
2011/09/01 23:01:52
Done.
|
+ base::StringPiece::npos) |
return false; |
break; |
case BIRTH_FUNCTION: |
- if (!strstr(sample.location().function_name(), required_.c_str())) |
+ if (sample.location().function_name().find(required_.c_str()) == |
+ base::StringPiece::npos) |
return false; |
break; |
@@ -1007,8 +1005,9 @@ bool Comparator::WriteSortGrouping(const Snapshot& sample, |
break; |
case BIRTH_FILE: |
- base::StringAppendF(output, "All born in %s ", |
- sample.location().file_name()); |
+ output->append("All born in "); |
+ sample.location().file_name().AppendToString(output); |
+ output->append(" "); |
break; |
case BIRTH_FUNCTION: |