summaryrefslogtreecommitdiff
path: root/libdexfile/dex/method_reference.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2024-05-10 14:44:09 +0200
committer VladimĂ­r Marko <vmarko@google.com> 2024-05-13 12:18:14 +0000
commit8ad286a19ba206224072fb84b0bd599c5d25cdbe (patch)
tree5dc59770fb60d3cafda0d7a5608fe9f84a794e73 /libdexfile/dex/method_reference.h
parentffc0d1f69841fe4dcc8dca0676fb13466b9b8132 (diff)
Clean up descriptor and member name comparisons.
Add helper functions for these comparisons to keep comments related to ordering in one place. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I510a1cbbb46a22ddbd39d0530198cd004b476a8d
Diffstat (limited to 'libdexfile/dex/method_reference.h')
-rw-r--r--libdexfile/dex/method_reference.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/libdexfile/dex/method_reference.h b/libdexfile/dex/method_reference.h
index 0472f2d492..209ab7a994 100644
--- a/libdexfile/dex/method_reference.h
+++ b/libdexfile/dex/method_reference.h
@@ -56,16 +56,15 @@ struct MethodReferenceValueComparator {
// Compare the class descriptors first.
const dex::MethodId& mid1 = mr1.GetMethodId();
const dex::MethodId& mid2 = mr2.GetMethodId();
- // Note: `std::string_view::compare()` uses lexicographical comparison and treats the `char`
- // as unsigned; for Modified-UTF-8 without embedded nulls this is consistent with the
- // `CompareModifiedUtf8ToModifiedUtf8AsUtf16CodePointValues()` ordering.
- int descriptor_diff = mr1.dex_file->GetTypeDescriptorView(mid1.class_idx_).compare(
- mr2.dex_file->GetTypeDescriptorView(mid2.class_idx_));
+ int descriptor_diff = DexFile::CompareDescriptors(
+ mr1.dex_file->GetTypeDescriptorView(mid1.class_idx_),
+ mr2.dex_file->GetTypeDescriptorView(mid2.class_idx_));
if (descriptor_diff != 0) {
return descriptor_diff < 0;
}
// Compare names second.
- int name_diff = strcmp(mr1.dex_file->GetMethodName(mid1), mr2.dex_file->GetMethodName(mid2));
+ int name_diff = DexFile::CompareMemberNames(mr1.dex_file->GetMethodNameView(mid1),
+ mr2.dex_file->GetMethodNameView(mid2));
if (name_diff != 0) {
return name_diff < 0;
}