Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: runtime/vm/zone.cc

Issue 2011543002: Canonicalize uris in C++ instead of Dart for the standalone embedder. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fixz release build Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/zone.h ('k') | tests/corelib/uri_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « runtime/vm/zone.h ('k') | tests/corelib/uri_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698