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

Unified Diff: src/platform-macos.cc

Issue 13093: Fixed d8 on leopard. (Closed)
Patch Set: Created 12 years 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
Index: src/platform-macos.cc
diff --git a/src/platform-macos.cc b/src/platform-macos.cc
index f08d64d0c961c53d51ad125314c8d31129d0ce6b..80308a67736b30341f6136f2d7e8fee04a9c4020 100644
--- a/src/platform-macos.cc
+++ b/src/platform-macos.cc
@@ -190,11 +190,26 @@ void OS::StrNCpy(Vector<char> dest, const char* src, size_t n) {
}
-char *OS::StrDup(const char* str) {
+char* OS::StrDup(const char* str) {
return strdup(str);
}
+char* OS::StrNDup(const char* str, size_t n) {
+ // Stupid implementation of strndup since mac isn't born with
+ // one.
+ size_t len = strlen(str);
+ if (len < n)
Erik Corry 2008/12/03 13:43:22 Might as well use StrDup for the case where len ==
+ return StrDup(str);
+ char* result = new char[n+1];
+ size_t i;
+ for (i = 0; i <= n; i++)
+ result[i] = str[i];
+ result[i] = '\0';
+ return result;
+}
+
+
// We keep the lowest and highest addresses mapped as a quick way of
// determining that pointers are outside the heap (used mostly in assertions
// and verification). The estimate is conservative, ie, not all addresses in

Powered by Google App Engine
This is Rietveld 408576698