}
-char *OS::StrDup(const char* str) {
- return strdup(str);
-}
-
-
-char* OS::StrNDup(const char* str, size_t n) {
- // Stupid implementation of strndup since freebsd isn't born with
- // one.
- size_t len = strlen(str);
- if (len <= n) {
- 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;
-}
-
-
double OS::nan_value() {
return NAN;
}
}
-char* OS::StrDup(const char* str) {
- return strdup(str);
-}
-
-
-char* OS::StrNDup(const char* str, size_t n) {
- return strndup(str, n);
-}
-
-
double OS::nan_value() {
return NAN;
}
}
-char* OS::StrDup(const char* str) {
- return strdup(str);
-}
-
-
-char* OS::StrNDup(const char* str, size_t n) {
- // Stupid implementation of strndup since macos isn't born with
- // one.
- size_t len = strlen(str);
- if (len <= n) {
- 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
}
-char* OS::StrDup(const char* str) {
- return _strdup(str);
-}
-
-
-char* OS::StrNDup(const char* str, size_t n) {
- // Stupid implementation of strndup since windows isn't born with
- // one.
- size_t len = strlen(str);
- if (len <= n) {
- 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
static char* StrChr(char* str, int c);
static void StrNCpy(Vector<char> dest, const char* src, size_t n);
- static char* StrDup(const char* str);
- static char* StrNDup(const char* str, size_t n);
// Support for profiler. Can do nothing, in which case ticks
// occuring in shared libraries will not be properly accounted
basename = strrchr(const_cast<char *>(file), '\\');
}
if (!basename) {
- basename = v8::internal::OS::StrDup(file);
+ basename = v8::internal::StrDup(file);
} else {
- basename = v8::internal::OS::StrDup(basename + 1);
+ basename = v8::internal::StrDup(basename + 1);
}
// Drop the extension, if there is one.
char *extension = strrchr(basename, '.');
print_run_count = false;
} else {
- char* arg_copy = v8::internal::OS::StrDup(arg);
+ char* arg_copy = v8::internal::StrDup(arg);
char* testname = strchr(arg_copy, '/');
if (testname) {
// Split the string in two by nulling the slash and then run
test = test->prev();
}
}
- free(arg_copy);
+ v8::internal::DeleteArray<char>(arg_copy);
}
}
if (print_run_count && tests_run != 1)