Index: runtime/vm/zone.cc |
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc |
index dc170449b2b6c49dff687525b988419230401174..0f6754fd15f1a4615c596cd56ae1502c3ebac002 100644 |
--- a/runtime/vm/zone.cc |
+++ b/runtime/vm/zone.cc |
@@ -169,6 +169,21 @@ char* Zone::MakeCopyOfString(const char* str) { |
} |
+char* Zone::MakeCopyOfStringN(const char* str, intptr_t len) { |
+ ASSERT(len >= 0); |
+ for (intptr_t i = 0; i < len; i++) { |
+ if (str[i] == '\0') { |
+ len = i; |
+ break; |
+ } |
+ } |
+ char* copy = Alloc<char>(len + 1); // +1 for '\0' |
+ strncpy(copy, str, len); |
+ copy[len] = '\0'; |
+ return copy; |
+} |
+ |
+ |
char* Zone::ConcatStrings(const char* a, const char* b, char join) { |
intptr_t a_len = (a == NULL) ? 0 : strlen(a); |
const intptr_t b_len = strlen(b) + 1; // '\0'-terminated. |