summaryrefslogtreecommitdiffstats
path: root/runtime/dex_file.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/dex_file.cc')
-rw-r--r--runtime/dex_file.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc
index 0ddcdf30c9..a7575ce889 100644
--- a/runtime/dex_file.cc
+++ b/runtime/dex_file.cc
@@ -555,22 +555,19 @@ bool DexFile::CreateTypeList(const StringPiece& signature, uint16_t* return_type
size_t end = signature.size();
bool process_return = false;
while (offset < end) {
+ size_t start_offset = offset;
char c = signature[offset];
offset++;
if (c == ')') {
process_return = true;
continue;
}
- // TODO: avoid building a string.
- std::string descriptor;
- descriptor += c;
while (c == '[') { // process array prefix
if (offset >= end) { // expect some descriptor following [
return false;
}
c = signature[offset];
offset++;
- descriptor += c;
}
if (c == 'L') { // process type descriptors
do {
@@ -579,9 +576,10 @@ bool DexFile::CreateTypeList(const StringPiece& signature, uint16_t* return_type
}
c = signature[offset];
offset++;
- descriptor += c;
} while (c != ';');
}
+ // TODO: avoid creating a std::string just to get a 0-terminated char array
+ std::string descriptor(signature.data() + start_offset, offset - start_offset);
const DexFile::StringId* string_id = FindStringId(descriptor.c_str());
if (string_id == NULL) {
return false;