Index: vm/os_macos.cc |
=================================================================== |
--- vm/os_macos.cc (revision 9601) |
+++ vm/os_macos.cc (working copy) |
@@ -136,6 +136,29 @@ |
} |
+bool OS::StringToInteger(const char* str, int64_t* value) { |
+ ASSERT(str != NULL && strlen(str) > 0 && value != NULL); |
+ bool negative_value = false; |
+ int32_t base = 10; |
+ if (str[0] == '-') { |
+ negative_value = true; |
+ str += 1; |
+ } |
+ if ((str[0] == '0') && (str[1] == 'x' || str[1] == 'X') && (str[2] != '\0')) { |
+ base = 16; |
+ } |
+ errno = 0; |
+ *value = strtoll(str, NULL, base); |
+ if (errno == 0) { |
+ if (negative_value) { |
+ *value = -(*value); |
+ } |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+ |
void OS::PrintErr(const char* format, ...) { |
va_list args; |
va_start(args, format); |