Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/assert.h" | 8 #include "vm/assert.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 5326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5337 // Lengths don't match. | 5337 // Lengths don't match. |
| 5338 return false; | 5338 return false; |
| 5339 } | 5339 } |
| 5340 int32_t ch; | 5340 int32_t ch; |
| 5341 intptr_t consumed = Utf8::Decode(str, &ch); | 5341 intptr_t consumed = Utf8::Decode(str, &ch); |
| 5342 if (consumed == 0 || this->CharAt(i) != ch) { | 5342 if (consumed == 0 || this->CharAt(i) != ch) { |
| 5343 return false; | 5343 return false; |
| 5344 } | 5344 } |
| 5345 str += consumed; | 5345 str += consumed; |
| 5346 } | 5346 } |
| 5347 return true; | 5347 return str[0] == '\0'; |
|
cshapiro
2011/10/21 20:12:47
How about "*str == '\0'" instead to be consistent
Anton Muhin
2011/10/24 15:59:34
Done.
| |
| 5348 } | 5348 } |
| 5349 | 5349 |
| 5350 | 5350 |
| 5351 bool String::Equals(const uint8_t* characters, intptr_t len) const { | 5351 bool String::Equals(const uint8_t* characters, intptr_t len) const { |
| 5352 if (len != this->Length()) { | 5352 if (len != this->Length()) { |
| 5353 // Lengths don't match. | 5353 // Lengths don't match. |
| 5354 return false; | 5354 return false; |
| 5355 } | 5355 } |
| 5356 | 5356 |
| 5357 for (intptr_t i = 0; i < len; i++) { | 5357 for (intptr_t i = 0; i < len; i++) { |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6688 const String& str = String::Handle(pattern()); | 6688 const String& str = String::Handle(pattern()); |
| 6689 const char* format = "JSRegExp: pattern=%s flags=%s"; | 6689 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 6690 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 6690 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 6691 char* chars = reinterpret_cast<char*>( | 6691 char* chars = reinterpret_cast<char*>( |
| 6692 Isolate::Current()->current_zone()->Allocate(len + 1)); | 6692 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 6693 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 6693 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 6694 return chars; | 6694 return chars; |
| 6695 } | 6695 } |
| 6696 | 6696 |
| 6697 } // namespace dart | 6697 } // namespace dart |
| OLD | NEW |