| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 strncpy(dest.start(), src, n); | 188 strncpy(dest.start(), src, n); |
| 189 } | 189 } |
| 190 | 190 |
| 191 | 191 |
| 192 char *OS::StrDup(const char* str) { | 192 char *OS::StrDup(const char* str) { |
| 193 return strdup(str); | 193 return strdup(str); |
| 194 } | 194 } |
| 195 | 195 |
| 196 | 196 |
| 197 char* OS::StrNDup(const char* str, size_t n) { | 197 char* OS::StrNDup(const char* str, size_t n) { |
| 198 return strndup(str, n); | 198 // Stupid implementation of strndup since freebsd isn't born with |
| 199 // one. |
| 200 size_t len = strlen(str); |
| 201 if (len <= n) { |
| 202 return StrDup(str); |
| 203 } |
| 204 char* result = new char[n+1]; |
| 205 size_t i; |
| 206 for (i = 0; i <= n; i++) { |
| 207 result[i] = str[i]; |
| 208 } |
| 209 result[i] = '\0'; |
| 210 return result; |
| 199 } | 211 } |
| 200 | 212 |
| 201 | 213 |
| 202 double OS::nan_value() { | 214 double OS::nan_value() { |
| 203 return NAN; | 215 return NAN; |
| 204 } | 216 } |
| 205 | 217 |
| 206 | 218 |
| 207 int OS::ActivationFrameAlignment() { | 219 int OS::ActivationFrameAlignment() { |
| 208 // 16 byte alignment on FreeBSD | 220 // 16 byte alignment on FreeBSD |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 } | 706 } |
| 695 | 707 |
| 696 // This sampler is no longer the active sampler. | 708 // This sampler is no longer the active sampler. |
| 697 active_sampler_ = NULL; | 709 active_sampler_ = NULL; |
| 698 active_ = false; | 710 active_ = false; |
| 699 } | 711 } |
| 700 | 712 |
| 701 #endif // ENABLE_LOGGING_AND_PROFILING | 713 #endif // ENABLE_LOGGING_AND_PROFILING |
| 702 | 714 |
| 703 } } // namespace v8::internal | 715 } } // namespace v8::internal |
| OLD | NEW |