summaryrefslogtreecommitdiff
path: root/compiler/utils/string_reference.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-06-28 08:57:50 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-06-28 08:57:50 +0000
commit05f0167cdd207edecaebf2cac7eea879678147c5 (patch)
tree709372e601adebdeee3221cd9fa7ba5dcbcbf4b5 /compiler/utils/string_reference.h
parent105683791e6b3f017a1a5673df22bf2185e19b54 (diff)
parent5c6a58734ef0c07dbb1e951e91c66b20a25160ce (diff)
Merge "Clean up StringReferenceValueComparator and DexFile."
Diffstat (limited to 'compiler/utils/string_reference.h')
-rw-r--r--compiler/utils/string_reference.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/utils/string_reference.h b/compiler/utils/string_reference.h
index 0ab45c86e3..e4c34ca605 100644
--- a/compiler/utils/string_reference.h
+++ b/compiler/utils/string_reference.h
@@ -29,6 +29,10 @@ namespace art {
struct StringReference {
StringReference(const DexFile* file, uint32_t index) : dex_file(file), string_index(index) { }
+ const char* GetStringData() const {
+ return dex_file->GetStringData(dex_file->GetStringId(string_index));
+ }
+
const DexFile* dex_file;
uint32_t string_index;
};
@@ -45,15 +49,13 @@ struct StringReferenceValueComparator {
// Use the string order enforced by the dex file verifier.
DCHECK_EQ(
sr1.string_index < sr2.string_index,
- CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(
- sr1.dex_file->GetStringData(sr1.dex_file->GetStringId(sr1.string_index)),
- sr2.dex_file->GetStringData(sr2.dex_file->GetStringId(sr2.string_index))) < 0);
+ CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(sr1.GetStringData(),
+ sr2.GetStringData()) < 0);
return sr1.string_index < sr2.string_index;
} else {
// Cannot compare indexes, so do the string comparison.
- return CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(
- sr1.dex_file->GetStringData(sr1.dex_file->GetStringId(sr1.string_index)),
- sr2.dex_file->GetStringData(sr2.dex_file->GetStringId(sr2.string_index))) < 0;
+ return CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues(sr1.GetStringData(),
+ sr2.GetStringData()) < 0;
}
}
};