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

Unified Diff: runtime/platform/c99_support_win.h

Issue 13587008: Updated VM stacktrace support (20898) with strndup impl. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | « no previous file | runtime/vm/code_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/c99_support_win.h
===================================================================
--- runtime/platform/c99_support_win.h (revision 20895)
+++ runtime/platform/c99_support_win.h (working copy)
@@ -9,6 +9,7 @@
// functions. Define them here.
#include <float.h>
+#include <string.h>
static const unsigned __int64 kQuietNaNMask =
static_cast<unsigned __int64>(0xfff) << 51;
@@ -64,4 +65,18 @@
}
}
+// size_t used to match function signature on other platforms.
+static inline char* strndup(const char* s, size_t n) {
+ size_t len = strlen(s);
+ if (n < len) {
+ len = n;
+ }
+ char* result = reinterpret_cast<char*>(malloc(len + 1));
+ if (!result) {
+ return NULL;
+ }
+ result[len] = '\0';
+ return reinterpret_cast<char*>(memcpy(result, s, len));
+}
+
#endif // PLATFORM_C99_SUPPORT_WIN_H_
« no previous file with comments | « no previous file | runtime/vm/code_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698