Index: runtime/vm/zone.cc |
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc |
index ea42f49055c2d6ce6d447feff7ec3b315a334cc7..7cb7977944dcbbc78dedecf334b15f109fe9c5bb 100644 |
--- a/runtime/vm/zone.cc |
+++ b/runtime/vm/zone.cc |
@@ -178,6 +178,21 @@ char* Zone::MakeCopyOfString(const char* str) { |
} |
+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. |
+ const intptr_t len = a_len + b_len; |
+ char* copy = Alloc<char>(len); |
+ if (a_len > 0) { |
+ strncpy(copy, a, a_len); |
+ // Insert join character. |
+ copy[a_len++] = join; |
+ } |
+ strncpy(©[a_len], b, b_len); |
+ return copy; |
+} |
+ |
+ |
#if defined(DEBUG) |
void Zone::DumpZoneSizes() { |
intptr_t size = 0; |