summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-19 17:52:58 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-19 17:52:58 +0000
commita214fbcec783a69818773d73d895ee0a92e43844 (patch)
treef5aa675acf95f6498fe334a1657654c43ce8b11c
parentbbc270be829518bf84edc103149f6a7534be7182 (diff)
downloadchromium_src-a214fbcec783a69818773d73d895ee0a92e43844.zip
chromium_src-a214fbcec783a69818773d73d895ee0a92e43844.tar.gz
chromium_src-a214fbcec783a69818773d73d895ee0a92e43844.tar.bz2
Base/Valgrind: Close the UStringSearch.
Fixes a leak. Also cleaned up a bit while I'm here. TBR=benjhayden,xji,rdsmith BUG=none TEST=Valgrind Review URL: http://codereview.chromium.org/7944007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101773 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/i18n/string_search.cc5
-rw-r--r--base/i18n/string_search_unittest.cc9
2 files changed, 6 insertions, 8 deletions
diff --git a/base/i18n/string_search.cc b/base/i18n/string_search.cc
index b2b29677..2983cba 100644
--- a/base/i18n/string_search.cc
+++ b/base/i18n/string_search.cc
@@ -27,7 +27,9 @@ bool CollationSensitiveStringSearch(const string16& find_this,
ucol_setStrength(collator, strength);
usearch_reset(search);
- return usearch_first(search, &status) != USEARCH_DONE;
+ bool result = usearch_first(search, &status) != USEARCH_DONE;
+ usearch_close(search);
+ return result;
}
} // namespace
@@ -42,4 +44,3 @@ bool StringSearchIgnoringCaseAndAccents(const string16& find_this,
} // namespace i18n
} // namespace base
-
diff --git a/base/i18n/string_search_unittest.cc b/base/i18n/string_search_unittest.cc
index fe877c0..fc1f281 100644
--- a/base/i18n/string_search_unittest.cc
+++ b/base/i18n/string_search_unittest.cc
@@ -13,16 +13,13 @@
namespace base {
namespace i18n {
-class StringSearchTest : public testing::Test {
-};
-
// Note on setting default locale for testing: The current default locale on
// the Mac trybot is en_US_POSIX, with which primary-level collation strength
// string search is case-sensitive, when normally it should be
// case-insensitive. In other locales (including en_US which English speakers
// in the U.S. use), this search would be case-insensitive as expected.
-TEST_F(StringSearchTest, ASCII) {
+TEST(StringSearchTest, ASCII) {
std::string default_locale(uloc_getDefault());
bool locale_is_posix = (default_locale == "en_US_POSIX");
if (locale_is_posix)
@@ -50,7 +47,7 @@ TEST_F(StringSearchTest, ASCII) {
SetICUDefaultLocale(default_locale.data());
}
-TEST_F(StringSearchTest, UnicodeLocaleIndependent) {
+TEST(StringSearchTest, UnicodeLocaleIndependent) {
// Base characters
const string16 e_base = WideToUTF16(L"e");
const string16 E_base = WideToUTF16(L"E");
@@ -130,7 +127,7 @@ TEST_F(StringSearchTest, UnicodeLocaleIndependent) {
SetICUDefaultLocale(default_locale.data());
}
-TEST_F(StringSearchTest, UnicodeLocaleDependent) {
+TEST(StringSearchTest, UnicodeLocaleDependent) {
// Base characters
const string16 a_base = WideToUTF16(L"a");