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

Side by Side 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, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/code_generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef PLATFORM_C99_SUPPORT_WIN_H_ 5 #ifndef PLATFORM_C99_SUPPORT_WIN_H_
6 #define PLATFORM_C99_SUPPORT_WIN_H_ 6 #define PLATFORM_C99_SUPPORT_WIN_H_
7 7
8 // Visual C++ is missing a bunch of C99 math macros and 8 // Visual C++ is missing a bunch of C99 math macros and
9 // functions. Define them here. 9 // functions. Define them here.
10 10
11 #include <float.h> 11 #include <float.h>
12 #include <string.h>
12 13
13 static const unsigned __int64 kQuietNaNMask = 14 static const unsigned __int64 kQuietNaNMask =
14 static_cast<unsigned __int64>(0xfff) << 51; 15 static_cast<unsigned __int64>(0xfff) << 51;
15 16
16 17
17 #ifndef va_copy 18 #ifndef va_copy
18 #define va_copy(dst, src) (memmove(&(dst), &(src), sizeof(dst))) 19 #define va_copy(dst, src) (memmove(&(dst), &(src), sizeof(dst)))
19 #endif /* va_copy */ 20 #endif /* va_copy */
20 21
21 22
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 58
58 if (fractpart >= 0.5) { 59 if (fractpart >= 0.5) {
59 return intpart + 1; 60 return intpart + 1;
60 } else if (fractpart > -0.5) { 61 } else if (fractpart > -0.5) {
61 return intpart; 62 return intpart;
62 } else { 63 } else {
63 return intpart - 1; 64 return intpart - 1;
64 } 65 }
65 } 66 }
66 67
68 // size_t used to match function signature on other platforms.
69 static inline char* strndup(const char* s, size_t n) {
70 size_t len = strlen(s);
71 if (n < len) {
72 len = n;
73 }
74 char* result = reinterpret_cast<char*>(malloc(len + 1));
75 if (!result) {
76 return NULL;
77 }
78 result[len] = '\0';
79 return reinterpret_cast<char*>(memcpy(result, s, len));
80 }
81
67 #endif // PLATFORM_C99_SUPPORT_WIN_H_ 82 #endif // PLATFORM_C99_SUPPORT_WIN_H_
OLDNEW
« 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