OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 VM_ZONE_H_ | 5 #ifndef VM_ZONE_H_ |
6 #define VM_ZONE_H_ | 6 #define VM_ZONE_H_ |
7 | 7 |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/handles.h" | 10 #include "vm/handles.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // | 38 // |
39 // It is preferred to use Alloc<T>() instead, as that function can | 39 // It is preferred to use Alloc<T>() instead, as that function can |
40 // check for integer overflow. If you use AllocUnsafe, you are | 40 // check for integer overflow. If you use AllocUnsafe, you are |
41 // responsible for avoiding integer overflow yourself. | 41 // responsible for avoiding integer overflow yourself. |
42 inline uword AllocUnsafe(intptr_t size); | 42 inline uword AllocUnsafe(intptr_t size); |
43 | 43 |
44 | 44 |
45 // Make a copy of the string in the zone allocated area. | 45 // Make a copy of the string in the zone allocated area. |
46 char* MakeCopyOfString(const char* str); | 46 char* MakeCopyOfString(const char* str); |
47 | 47 |
| 48 // Make a copy of the first n characters of a string in the zone |
| 49 // allocated area. |
| 50 char* MakeCopyOfStringN(const char* str, intptr_t len); |
| 51 |
48 // Concatenate strings |a| and |b|. |a| may be NULL. If |a| is not NULL, | 52 // Concatenate strings |a| and |b|. |a| may be NULL. If |a| is not NULL, |
49 // |join| will be inserted between |a| and |b|. | 53 // |join| will be inserted between |a| and |b|. |
50 char* ConcatStrings(const char* a, const char* b, char join = ','); | 54 char* ConcatStrings(const char* a, const char* b, char join = ','); |
51 | 55 |
52 // TODO(zra): Remove these calls and replace them with calls to OS::SCreate | 56 // TODO(zra): Remove these calls and replace them with calls to OS::SCreate |
53 // and OS::VSCreate. | 57 // and OS::VSCreate. |
54 // These calls are deprecated. Do not add further calls to these functions. | 58 // These calls are deprecated. Do not add further calls to these functions. |
55 // instead use OS::SCreate and OS::VSCreate. | 59 // instead use OS::SCreate and OS::VSCreate. |
56 // Make a zone-allocated string based on printf format and args. | 60 // Make a zone-allocated string based on printf format and args. |
57 char* PrintToString(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 61 char* PrintToString(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 memmove(reinterpret_cast<void*>(new_data), | 285 memmove(reinterpret_cast<void*>(new_data), |
282 reinterpret_cast<void*>(old_data), | 286 reinterpret_cast<void*>(old_data), |
283 old_len * kElementSize); | 287 old_len * kElementSize); |
284 } | 288 } |
285 return new_data; | 289 return new_data; |
286 } | 290 } |
287 | 291 |
288 } // namespace dart | 292 } // namespace dart |
289 | 293 |
290 #endif // VM_ZONE_H_ | 294 #endif // VM_ZONE_H_ |
OLD | NEW |