/src/icu/icu4c/source/common/cmemory.h
Line | Count | Source |
1 | | // © 2016 and later: Unicode, Inc. and others. |
2 | | // License & terms of use: http://www.unicode.org/copyright.html |
3 | | /* |
4 | | ****************************************************************************** |
5 | | * |
6 | | * Copyright (C) 1997-2016, International Business Machines |
7 | | * Corporation and others. All Rights Reserved. |
8 | | * |
9 | | ****************************************************************************** |
10 | | * |
11 | | * File CMEMORY.H |
12 | | * |
13 | | * Contains stdlib.h/string.h memory functions |
14 | | * |
15 | | * @author Bertrand A. Damiba |
16 | | * |
17 | | * Modification History: |
18 | | * |
19 | | * Date Name Description |
20 | | * 6/20/98 Bertrand Created. |
21 | | * 05/03/99 stephen Changed from functions to macros. |
22 | | * |
23 | | ****************************************************************************** |
24 | | */ |
25 | | |
26 | | #ifndef CMEMORY_H |
27 | | #define CMEMORY_H |
28 | | |
29 | | #include "unicode/utypes.h" |
30 | | |
31 | | #include <stddef.h> |
32 | | #include <string.h> |
33 | | #include "unicode/localpointer.h" |
34 | | #include "uassert.h" |
35 | | |
36 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) |
37 | | #include <stdio.h> |
38 | | #endif |
39 | | |
40 | | // uprv_memcpy and uprv_memmove |
41 | | #if defined(__clang__) |
42 | 1.65G | #define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ |
43 | 1.65G | /* Suppress warnings about addresses that will never be NULL */ \ |
44 | 1.65G | _Pragma("clang diagnostic push") \ |
45 | 1.65G | _Pragma("clang diagnostic ignored \"-Waddress\"") \ |
46 | 1.65G | U_ASSERT(dst != NULL); \ |
47 | 1.65G | U_ASSERT(src != NULL); \ |
48 | 1.65G | _Pragma("clang diagnostic pop") \ |
49 | 1.65G | U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \ |
50 | 1.65G | } UPRV_BLOCK_MACRO_END |
51 | 285M | #define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ |
52 | 285M | /* Suppress warnings about addresses that will never be NULL */ \ |
53 | 285M | _Pragma("clang diagnostic push") \ |
54 | 285M | _Pragma("clang diagnostic ignored \"-Waddress\"") \ |
55 | 285M | U_ASSERT(dst != NULL); \ |
56 | 285M | U_ASSERT(src != NULL); \ |
57 | 285M | _Pragma("clang diagnostic pop") \ |
58 | 285M | U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \ |
59 | 285M | } UPRV_BLOCK_MACRO_END |
60 | | #elif defined(__GNUC__) |
61 | | #define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ |
62 | | /* Suppress warnings about addresses that will never be NULL */ \ |
63 | | _Pragma("GCC diagnostic push") \ |
64 | | _Pragma("GCC diagnostic ignored \"-Waddress\"") \ |
65 | | U_ASSERT(dst != NULL); \ |
66 | | U_ASSERT(src != NULL); \ |
67 | | _Pragma("GCC diagnostic pop") \ |
68 | | U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \ |
69 | | } UPRV_BLOCK_MACRO_END |
70 | | #define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ |
71 | | /* Suppress warnings about addresses that will never be NULL */ \ |
72 | | _Pragma("GCC diagnostic push") \ |
73 | | _Pragma("GCC diagnostic ignored \"-Waddress\"") \ |
74 | | U_ASSERT(dst != NULL); \ |
75 | | U_ASSERT(src != NULL); \ |
76 | | _Pragma("GCC diagnostic pop") \ |
77 | | U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \ |
78 | | } UPRV_BLOCK_MACRO_END |
79 | | #else |
80 | | #define uprv_memcpy(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ |
81 | | U_ASSERT(dst != NULL); \ |
82 | | U_ASSERT(src != NULL); \ |
83 | | U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size); \ |
84 | | } UPRV_BLOCK_MACRO_END |
85 | | #define uprv_memmove(dst, src, size) UPRV_BLOCK_MACRO_BEGIN { \ |
86 | | U_ASSERT(dst != NULL); \ |
87 | | U_ASSERT(src != NULL); \ |
88 | | U_STANDARD_CPP_NAMESPACE memmove(dst, src, size); \ |
89 | | } UPRV_BLOCK_MACRO_END |
90 | | #endif |
91 | | |
92 | | /** |
93 | | * \def UPRV_LENGTHOF |
94 | | * Convenience macro to determine the length of a fixed array at compile-time. |
95 | | * @param array A fixed length array |
96 | | * @return The length of the array, in elements |
97 | | * @internal |
98 | | */ |
99 | 192M | #define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) |
100 | 122M | #define uprv_memset(buffer, mark, size) U_STANDARD_CPP_NAMESPACE memset(buffer, mark, size) |
101 | 869M | #define uprv_memcmp(buffer1, buffer2, size) U_STANDARD_CPP_NAMESPACE memcmp(buffer1, buffer2,size) |
102 | 0 | #define uprv_memchr(ptr, value, num) U_STANDARD_CPP_NAMESPACE memchr(ptr, value, num) |
103 | | |
104 | | U_CAPI void * U_EXPORT2 |
105 | | uprv_malloc(size_t s) U_MALLOC_ATTR U_ALLOC_SIZE_ATTR(1); |
106 | | |
107 | | U_CAPI void * U_EXPORT2 |
108 | | uprv_realloc(void *mem, size_t size) U_ALLOC_SIZE_ATTR(2); |
109 | | |
110 | | U_CAPI void U_EXPORT2 |
111 | | uprv_free(void *mem); |
112 | | |
113 | | U_CAPI void * U_EXPORT2 |
114 | | uprv_calloc(size_t num, size_t size) U_MALLOC_ATTR U_ALLOC_SIZE_ATTR2(1,2); |
115 | | |
116 | | /** |
117 | | * Get the least significant bits of a pointer (a memory address). |
118 | | * For example, with a mask of 3, the macro gets the 2 least significant bits, |
119 | | * which will be 0 if the pointer is 32-bit (4-byte) aligned. |
120 | | * |
121 | | * uintptr_t is the most appropriate integer type to cast to. |
122 | | */ |
123 | 27.1k | #define U_POINTER_MASK_LSB(ptr, mask) ((uintptr_t)(ptr) & (mask)) |
124 | | |
125 | | /** |
126 | | * Create & return an instance of "type" in statically allocated storage. |
127 | | * e.g. |
128 | | * static std::mutex *myMutex = STATIC_NEW(std::mutex); |
129 | | * To destroy an object created in this way, invoke the destructor explicitly, e.g. |
130 | | * myMutex->~mutex(); |
131 | | * DO NOT use delete. |
132 | | * DO NOT use with class UMutex, which has specific support for static instances. |
133 | | * |
134 | | * STATIC_NEW is intended for use when |
135 | | * - We want a static (or global) object. |
136 | | * - We don't want it to ever be destructed, or to explicitly control destruction, |
137 | | * to avoid use-after-destruction problems. |
138 | | * - We want to avoid an ordinary heap allocated object, |
139 | | * to avoid the possibility of memory allocation failures, and |
140 | | * to avoid memory leak reports, from valgrind, for example. |
141 | | * This is defined as a macro rather than a template function because each invocation |
142 | | * must define distinct static storage for the object being returned. |
143 | | */ |
144 | 82 | #define STATIC_NEW(type) [] () { \ |
145 | 82 | alignas(type) static char storage[sizeof(type)]; \ |
146 | 82 | return new(storage) type();} () umutex.cpp:icu_79::umtx_init()::$_0::operator()() const Line | Count | Source | 144 | 32 | #define STATIC_NEW(type) [] () { \ | 145 | 32 | alignas(type) static char storage[sizeof(type)]; \ | 146 | 32 | return new(storage) type();} () |
umutex.cpp:icu_79::umtx_init()::$_1::operator()() const Line | Count | Source | 144 | 32 | #define STATIC_NEW(type) [] () { \ | 145 | 32 | alignas(type) static char storage[sizeof(type)]; \ | 146 | 32 | return new(storage) type();} () |
unifiedcache.cpp:icu_79::cacheInit(UErrorCode&)::$_0::operator()() const Line | Count | Source | 144 | 9 | #define STATIC_NEW(type) [] () { \ | 145 | 9 | alignas(type) static char storage[sizeof(type)]; \ | 146 | 9 | return new(storage) type();} () |
unifiedcache.cpp:icu_79::cacheInit(UErrorCode&)::$_1::operator()() const Line | Count | Source | 144 | 9 | #define STATIC_NEW(type) [] () { \ | 145 | 9 | alignas(type) static char storage[sizeof(type)]; \ | 146 | 9 | return new(storage) type();} () |
|
147 | | |
148 | | /** |
149 | | * Heap clean up function, called from u_cleanup() |
150 | | * Clears any user heap functions from u_setMemoryFunctions() |
151 | | * Does NOT deallocate any remaining allocated memory. |
152 | | */ |
153 | | U_CFUNC UBool |
154 | | cmemory_cleanup(void); |
155 | | |
156 | | /** |
157 | | * A function called by <TT>uhash_remove</TT>, |
158 | | * <TT>uhash_close</TT>, or <TT>uhash_put</TT> to delete |
159 | | * an existing key or value. |
160 | | * @param obj A key or value stored in a hashtable |
161 | | * @see uprv_deleteUObject |
162 | | */ |
163 | | typedef void U_CALLCONV UObjectDeleter(void* obj); |
164 | | |
165 | | /** |
166 | | * Deleter for UObject instances. |
167 | | * Works for all subclasses of UObject because it has a virtual destructor. |
168 | | */ |
169 | | U_CAPI void U_EXPORT2 |
170 | | uprv_deleteUObject(void *obj); |
171 | | |
172 | | #ifdef __cplusplus |
173 | | |
174 | | #include <utility> |
175 | | #include "unicode/uobject.h" |
176 | | |
177 | | U_NAMESPACE_BEGIN |
178 | | |
179 | | /** |
180 | | * "Smart pointer" class, deletes memory via uprv_free(). |
181 | | * For most methods see the LocalPointerBase base class. |
182 | | * Adds operator[] for array item access. |
183 | | * |
184 | | * @see LocalPointerBase |
185 | | */ |
186 | | template<typename T> |
187 | | class LocalMemory : public LocalPointerBase<T> { |
188 | | public: |
189 | | using LocalPointerBase<T>::operator*; |
190 | | using LocalPointerBase<T>::operator->; |
191 | | /** |
192 | | * Constructor takes ownership. |
193 | | * @param p simple pointer to an array of T items that is adopted |
194 | | */ |
195 | 35.0k | explicit LocalMemory(T *p=nullptr) : LocalPointerBase<T>(p) {}icu_79::LocalMemory<int>::LocalMemory(int*) Line | Count | Source | 195 | 23.1k | explicit LocalMemory(T *p=nullptr) : LocalPointerBase<T>(p) {} |
icu_79::LocalMemory<char const*>::LocalMemory(char const**) Line | Count | Source | 195 | 75 | explicit LocalMemory(T *p=nullptr) : LocalPointerBase<T>(p) {} |
icu_79::LocalMemory<icu_79::RBBIDataHeader>::LocalMemory(icu_79::RBBIDataHeader*) Line | Count | Source | 195 | 2.62k | explicit LocalMemory(T *p=nullptr) : LocalPointerBase<T>(p) {} |
icu_79::LocalMemory<UKeywordsContext>::LocalMemory(UKeywordsContext*) Line | Count | Source | 195 | 4.44k | explicit LocalMemory(T *p=nullptr) : LocalPointerBase<T>(p) {} |
icu_79::LocalMemory<UEnumeration>::LocalMemory(UEnumeration*) Line | Count | Source | 195 | 4.44k | explicit LocalMemory(T *p=nullptr) : LocalPointerBase<T>(p) {} |
icu_79::LocalMemory<bool>::LocalMemory(bool*) Line | Count | Source | 195 | 1 | explicit LocalMemory(T *p=nullptr) : LocalPointerBase<T>(p) {} |
Unexecuted instantiation: icu_79::LocalMemory<icu_79::ZNameInfo>::LocalMemory(icu_79::ZNameInfo*) icu_79::LocalMemory<char16_t>::LocalMemory(char16_t*) Line | Count | Source | 195 | 382 | explicit LocalMemory(T *p=nullptr) : LocalPointerBase<T>(p) {} |
Unexecuted instantiation: icu_79::LocalMemory<icu_79::TimeZoneRule const*>::LocalMemory(icu_79::TimeZoneRule const**) Unexecuted instantiation: icu_79::LocalMemory<double>::LocalMemory(double*) Unexecuted instantiation: icu_79::LocalMemory<unsigned char>::LocalMemory(unsigned char*) |
196 | | /** |
197 | | * Move constructor, leaves src with isNull(). |
198 | | * @param src source smart pointer |
199 | | */ |
200 | | LocalMemory(LocalMemory<T> &&src) noexcept : LocalPointerBase<T>(src.ptr) { |
201 | | src.ptr=nullptr; |
202 | | } |
203 | | /** |
204 | | * Destructor deletes the memory it owns. |
205 | | */ |
206 | 35.0k | ~LocalMemory() { |
207 | 35.0k | uprv_free(LocalPointerBase<T>::ptr); |
208 | 35.0k | } icu_79::LocalMemory<int>::~LocalMemory() Line | Count | Source | 206 | 23.1k | ~LocalMemory() { | 207 | 23.1k | uprv_free(LocalPointerBase<T>::ptr); | 208 | 23.1k | } |
icu_79::LocalMemory<char const*>::~LocalMemory() Line | Count | Source | 206 | 75 | ~LocalMemory() { | 207 | 75 | uprv_free(LocalPointerBase<T>::ptr); | 208 | 75 | } |
icu_79::LocalMemory<icu_79::RBBIDataHeader>::~LocalMemory() Line | Count | Source | 206 | 2.62k | ~LocalMemory() { | 207 | 2.62k | uprv_free(LocalPointerBase<T>::ptr); | 208 | 2.62k | } |
icu_79::LocalMemory<UKeywordsContext>::~LocalMemory() Line | Count | Source | 206 | 4.44k | ~LocalMemory() { | 207 | 4.44k | uprv_free(LocalPointerBase<T>::ptr); | 208 | 4.44k | } |
icu_79::LocalMemory<UEnumeration>::~LocalMemory() Line | Count | Source | 206 | 4.44k | ~LocalMemory() { | 207 | 4.44k | uprv_free(LocalPointerBase<T>::ptr); | 208 | 4.44k | } |
icu_79::LocalMemory<bool>::~LocalMemory() Line | Count | Source | 206 | 1 | ~LocalMemory() { | 207 | 1 | uprv_free(LocalPointerBase<T>::ptr); | 208 | 1 | } |
Unexecuted instantiation: icu_79::LocalMemory<icu_79::ZNameInfo>::~LocalMemory() icu_79::LocalMemory<char16_t>::~LocalMemory() Line | Count | Source | 206 | 382 | ~LocalMemory() { | 207 | 382 | uprv_free(LocalPointerBase<T>::ptr); | 208 | 382 | } |
Unexecuted instantiation: icu_79::LocalMemory<icu_79::TimeZoneRule const*>::~LocalMemory() Unexecuted instantiation: icu_79::LocalMemory<double>::~LocalMemory() Unexecuted instantiation: icu_79::LocalMemory<unsigned char>::~LocalMemory() |
209 | | /** |
210 | | * Move assignment operator, leaves src with isNull(). |
211 | | * The behavior is undefined if *this and src are the same object. |
212 | | * @param src source smart pointer |
213 | | * @return *this |
214 | | */ |
215 | 10.9k | LocalMemory<T> &operator=(LocalMemory<T> &&src) noexcept { |
216 | 10.9k | uprv_free(LocalPointerBase<T>::ptr); |
217 | 10.9k | LocalPointerBase<T>::ptr=src.ptr; |
218 | 10.9k | src.ptr=nullptr; |
219 | 10.9k | return *this; |
220 | 10.9k | } |
221 | | /** |
222 | | * Swap pointers. |
223 | | * @param other other smart pointer |
224 | | */ |
225 | | void swap(LocalMemory<T> &other) noexcept { |
226 | | T *temp=LocalPointerBase<T>::ptr; |
227 | | LocalPointerBase<T>::ptr=other.ptr; |
228 | | other.ptr=temp; |
229 | | } |
230 | | /** |
231 | | * Non-member LocalMemory swap function. |
232 | | * @param p1 will get p2's pointer |
233 | | * @param p2 will get p1's pointer |
234 | | */ |
235 | | friend inline void swap(LocalMemory<T> &p1, LocalMemory<T> &p2) noexcept { |
236 | | p1.swap(p2); |
237 | | } |
238 | | /** |
239 | | * Deletes the array it owns, |
240 | | * and adopts (takes ownership of) the one passed in. |
241 | | * @param p simple pointer to an array of T items that is adopted |
242 | | */ |
243 | 8.89k | void adoptInstead(T *p) { |
244 | 8.89k | uprv_free(LocalPointerBase<T>::ptr); |
245 | 8.89k | LocalPointerBase<T>::ptr=p; |
246 | 8.89k | } icu_79::LocalMemory<UKeywordsContext>::adoptInstead(UKeywordsContext*) Line | Count | Source | 243 | 4.44k | void adoptInstead(T *p) { | 244 | 4.44k | uprv_free(LocalPointerBase<T>::ptr); | 245 | 4.44k | LocalPointerBase<T>::ptr=p; | 246 | 4.44k | } |
icu_79::LocalMemory<UEnumeration>::adoptInstead(UEnumeration*) Line | Count | Source | 243 | 4.44k | void adoptInstead(T *p) { | 244 | 4.44k | uprv_free(LocalPointerBase<T>::ptr); | 245 | 4.44k | LocalPointerBase<T>::ptr=p; | 246 | 4.44k | } |
|
247 | | /** |
248 | | * Deletes the array it owns, allocates a new one and reset its bytes to 0. |
249 | | * Returns the new array pointer. |
250 | | * If the allocation fails, then the current array is unchanged and |
251 | | * this method returns nullptr. |
252 | | * @param newCapacity must be >0 |
253 | | * @return the allocated array pointer, or nullptr if the allocation failed |
254 | | */ |
255 | | inline T *allocateInsteadAndReset(int32_t newCapacity=1); |
256 | | /** |
257 | | * Deletes the array it owns and allocates a new one, copying length T items. |
258 | | * Returns the new array pointer. |
259 | | * If the allocation fails, then the current array is unchanged and |
260 | | * this method returns nullptr. |
261 | | * @param newCapacity must be >0 |
262 | | * @param length number of T items to be copied from the old array to the new one; |
263 | | * must be no more than the capacity of the old array, |
264 | | * which the caller must track because the LocalMemory does not track it |
265 | | * @return the allocated array pointer, or nullptr if the allocation failed |
266 | | */ |
267 | | inline T *allocateInsteadAndCopy(int32_t newCapacity=1, int32_t length=0); |
268 | | /** |
269 | | * Array item access (writable). |
270 | | * No index bounds check. |
271 | | * @param i array index |
272 | | * @return reference to the array item |
273 | | */ |
274 | 2.36M | T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; }icu_79::LocalMemory<int>::operator[](long) const Line | Count | Source | 274 | 2.34M | T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; } |
icu_79::LocalMemory<char const*>::operator[](long) const Line | Count | Source | 274 | 19.3k | T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; } |
icu_79::LocalMemory<bool>::operator[](long) const Line | Count | Source | 274 | 21 | T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; } |
icu_79::LocalMemory<char16_t>::operator[](long) const Line | Count | Source | 274 | 382 | T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; } |
Unexecuted instantiation: icu_79::LocalMemory<icu_79::TimeZoneRule const*>::operator[](long) const Unexecuted instantiation: icu_79::LocalMemory<double>::operator[](long) const |
275 | | }; |
276 | | |
277 | | template<typename T> |
278 | 1.00k | inline T *LocalMemory<T>::allocateInsteadAndReset(int32_t newCapacity) { |
279 | 1.00k | if(newCapacity>0) { |
280 | 868 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); |
281 | 868 | if(p!=nullptr) { |
282 | 868 | uprv_memset(p, 0, newCapacity*sizeof(T)); |
283 | 868 | uprv_free(LocalPointerBase<T>::ptr); |
284 | 868 | LocalPointerBase<T>::ptr=p; |
285 | 868 | } |
286 | 868 | return p; |
287 | 868 | } else { |
288 | 137 | return nullptr; |
289 | 137 | } |
290 | 1.00k | } |
291 | | |
292 | | |
293 | | template<typename T> |
294 | 195 | inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t length) { |
295 | 195 | if(newCapacity>0) { |
296 | 195 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); |
297 | 195 | if(p!=nullptr) { |
298 | 195 | if(length>0) { |
299 | 0 | if(length>newCapacity) { |
300 | 0 | length=newCapacity; |
301 | 0 | } |
302 | 0 | uprv_memcpy(p, LocalPointerBase<T>::ptr, (size_t)length*sizeof(T)); |
303 | 0 | } |
304 | 195 | uprv_free(LocalPointerBase<T>::ptr); |
305 | 195 | LocalPointerBase<T>::ptr=p; |
306 | 195 | } |
307 | 195 | return p; |
308 | 195 | } else { |
309 | 0 | return nullptr; |
310 | 0 | } |
311 | 195 | } icu_79::LocalMemory<char const*>::allocateInsteadAndCopy(int, int) Line | Count | Source | 294 | 75 | inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t length) { | 295 | 75 | if(newCapacity>0) { | 296 | 75 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 297 | 75 | if(p!=nullptr) { | 298 | 75 | if(length>0) { | 299 | 0 | if(length>newCapacity) { | 300 | 0 | length=newCapacity; | 301 | 0 | } | 302 | 0 | uprv_memcpy(p, LocalPointerBase<T>::ptr, (size_t)length*sizeof(T)); | 303 | 0 | } | 304 | 75 | uprv_free(LocalPointerBase<T>::ptr); | 305 | 75 | LocalPointerBase<T>::ptr=p; | 306 | 75 | } | 307 | 75 | return p; | 308 | 75 | } else { | 309 | 0 | return nullptr; | 310 | 0 | } | 311 | 75 | } |
icu_79::LocalMemory<int>::allocateInsteadAndCopy(int, int) Line | Count | Source | 294 | 120 | inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t length) { | 295 | 120 | if(newCapacity>0) { | 296 | 120 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 297 | 120 | if(p!=nullptr) { | 298 | 120 | if(length>0) { | 299 | 0 | if(length>newCapacity) { | 300 | 0 | length=newCapacity; | 301 | 0 | } | 302 | 0 | uprv_memcpy(p, LocalPointerBase<T>::ptr, (size_t)length*sizeof(T)); | 303 | 0 | } | 304 | 120 | uprv_free(LocalPointerBase<T>::ptr); | 305 | 120 | LocalPointerBase<T>::ptr=p; | 306 | 120 | } | 307 | 120 | return p; | 308 | 120 | } else { | 309 | 0 | return nullptr; | 310 | 0 | } | 311 | 120 | } |
Unexecuted instantiation: icu_79::LocalMemory<unsigned char>::allocateInsteadAndCopy(int, int) |
312 | | |
313 | | /** |
314 | | * Simple array/buffer management class using uprv_malloc() and uprv_free(). |
315 | | * Provides an internal array with fixed capacity. Can alias another array |
316 | | * or allocate one. |
317 | | * |
318 | | * The array address is properly aligned for type T. It might not be properly |
319 | | * aligned for types larger than T (or larger than the largest subtype of T). |
320 | | * |
321 | | * Unlike LocalMemory and LocalArray, this class never adopts |
322 | | * (takes ownership of) another array. |
323 | | * |
324 | | * WARNING: MaybeStackArray only works with primitive (plain-old data) types. |
325 | | * It does NOT know how to call a destructor! If you work with classes with |
326 | | * destructors, consider: |
327 | | * |
328 | | * - LocalArray in localpointer.h if you know the length ahead of time |
329 | | * - MaybeStackVector if you know the length at runtime |
330 | | */ |
331 | | template<typename T, int32_t stackCapacity> |
332 | | class MaybeStackArray { |
333 | | public: |
334 | | // No heap allocation. Use only on the stack. |
335 | | static void* U_EXPORT2 operator new(size_t) noexcept = delete; |
336 | | static void* U_EXPORT2 operator new[](size_t) noexcept = delete; |
337 | | static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete; |
338 | | |
339 | | /** |
340 | | * Default constructor initializes with internal T[stackCapacity] buffer. |
341 | | */ |
342 | 176M | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {}Unexecuted instantiation: icu_79::MaybeStackArray<char16_t, 40>::MaybeStackArray() icu_79::MaybeStackArray<char, 40>::MaybeStackArray() Line | Count | Source | 342 | 132M | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::UnicodeString*, 8>::MaybeStackArray() Line | Count | Source | 342 | 24 | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<void*, 16>::MaybeStackArray() Line | Count | Source | 342 | 16.9M | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::FixedString*, 8>::MaybeStackArray() Line | Count | Source | 342 | 14 | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<LocExtKeyData*, 8>::MaybeStackArray() Line | Count | Source | 342 | 14 | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<LocExtType*, 8>::MaybeStackArray() Line | Count | Source | 342 | 14 | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<TypeAlias*, 8>::MaybeStackArray() Line | Count | Source | 342 | 14 | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::AttributeListEntry*, 8>::MaybeStackArray() Line | Count | Source | 342 | 50.9k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::ExtensionListEntry*, 8>::MaybeStackArray() Line | Count | Source | 342 | 60.4k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::CharString*, 8>::MaybeStackArray() Line | Count | Source | 342 | 110k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<max_align_t, 7>::MaybeStackArray() Line | Count | Source | 342 | 539k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<max_align_t, 14>::MaybeStackArray() Line | Count | Source | 342 | 363k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::Hashtable*, 8>::MaybeStackArray() Line | Count | Source | 342 | 11.0k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::SpanInfo, 8>::MaybeStackArray() Line | Count | Source | 342 | 11.9M | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<long, 40>::MaybeStackArray() Line | Count | Source | 342 | 5.39M | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<unsigned char, 40>::MaybeStackArray() Line | Count | Source | 342 | 32.7k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::MaybeStackArray() Line | Count | Source | 342 | 12.0k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<unsigned char, 20>::MaybeStackArray() Line | Count | Source | 342 | 2.02k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
Unexecuted instantiation: icu_79::MaybeStackArray<char, 30>::MaybeStackArray() icu_79::MaybeStackArray<long, 2>::MaybeStackArray() Line | Count | Source | 342 | 2.27M | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::LongNameHandler*, 8>::MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MixedUnitLongNameHandler*, 8>::MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MicroPropsGenerator*, 8>::MaybeStackArray() icu_79::MaybeStackArray<icu_79::units::ConversionRateInfo*, 8>::MaybeStackArray() Line | Count | Source | 342 | 100 | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<char16_t, 4>::MaybeStackArray() Line | Count | Source | 342 | 2.91M | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>::MaybeStackArray() Line | Count | Source | 342 | 208k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 10>::MaybeStackArray() Line | Count | Source | 342 | 104k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>::MaybeStackArray() Line | Count | Source | 342 | 51.3k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::units::UnitPreferenceMetadata*, 8>::MaybeStackArray() Line | Count | Source | 342 | 100 | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::units::UnitPreference*, 8>::MaybeStackArray() Line | Count | Source | 342 | 200 | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::UnitsConverter*, 8>::MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 8>::MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<long, 5>::MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 4>::MaybeStackArray() Unexecuted instantiation: units_converter.cpp:icu_79::MaybeStackArray<icu_79::units::(anonymous namespace)::UnitIndexAndDimension*, 8>::MaybeStackArray() icu_79::MaybeStackArray<icu_79::MeasureUnit*, 8>::MaybeStackArray() Line | Count | Source | 342 | 100 | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::units::ConverterPreference*, 8>::MaybeStackArray() Line | Count | Source | 342 | 100 | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::number::impl::CompactModInfo, 12>::MaybeStackArray() Line | Count | Source | 342 | 3.11k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>::MaybeStackArray() Line | Count | Source | 342 | 2.91M | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<icu_79::MessagePattern::Part, 32>::MaybeStackArray() Line | Count | Source | 342 | 48.5k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
icu_79::MaybeStackArray<double, 8>::MaybeStackArray() Line | Count | Source | 342 | 3.42k | MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {} |
|
343 | | /** |
344 | | * Automatically allocates the heap array if the argument is larger than the stack capacity. |
345 | | * Intended for use when an approximate capacity is known at compile time but the true |
346 | | * capacity is not known until runtime. |
347 | | */ |
348 | 186k | MaybeStackArray(int32_t newCapacity, UErrorCode status) : MaybeStackArray() { |
349 | 186k | if (U_FAILURE(status)) { |
350 | 0 | return; |
351 | 0 | } |
352 | 186k | if (capacity < newCapacity) { |
353 | 14.1k | if (resize(newCapacity) == nullptr) { |
354 | 0 | status = U_MEMORY_ALLOCATION_ERROR; |
355 | 0 | } |
356 | 14.1k | } |
357 | 186k | } icu_79::MaybeStackArray<unsigned char, 20>::MaybeStackArray(int, UErrorCode) Line | Count | Source | 348 | 2.02k | MaybeStackArray(int32_t newCapacity, UErrorCode status) : MaybeStackArray() { | 349 | 2.02k | if (U_FAILURE(status)) { | 350 | 0 | return; | 351 | 0 | } | 352 | 2.02k | if (capacity < newCapacity) { | 353 | 0 | if (resize(newCapacity) == nullptr) { | 354 | 0 | status = U_MEMORY_ALLOCATION_ERROR; | 355 | 0 | } | 356 | 0 | } | 357 | 2.02k | } |
Unexecuted instantiation: icu_79::MaybeStackArray<char, 30>::MaybeStackArray(int, UErrorCode) Unexecuted instantiation: icu_79::MaybeStackArray<long, 5>::MaybeStackArray(int, UErrorCode) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 4>::MaybeStackArray(int, UErrorCode) icu_79::MaybeStackArray<char16_t, 4>::MaybeStackArray(int, UErrorCode) Line | Count | Source | 348 | 184k | MaybeStackArray(int32_t newCapacity, UErrorCode status) : MaybeStackArray() { | 349 | 184k | if (U_FAILURE(status)) { | 350 | 0 | return; | 351 | 0 | } | 352 | 184k | if (capacity < newCapacity) { | 353 | 14.1k | if (resize(newCapacity) == nullptr) { | 354 | 0 | status = U_MEMORY_ALLOCATION_ERROR; | 355 | 0 | } | 356 | 14.1k | } | 357 | 184k | } |
|
358 | | /** |
359 | | * Destructor deletes the array (if owned). |
360 | | */ |
361 | 178M | ~MaybeStackArray() { releaseArray(); }Unexecuted instantiation: icu_79::MaybeStackArray<char16_t, 40>::~MaybeStackArray() icu_79::MaybeStackArray<char, 40>::~MaybeStackArray() Line | Count | Source | 361 | 133M | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::UnicodeString*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 24 | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<void*, 16>::~MaybeStackArray() Line | Count | Source | 361 | 16.9M | ~MaybeStackArray() { releaseArray(); } |
Unexecuted instantiation: icu_79::MaybeStackArray<LocExtKeyData*, 8>::~MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<LocExtType*, 8>::~MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<TypeAlias*, 8>::~MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::FixedString*, 8>::~MaybeStackArray() icu_79::MaybeStackArray<icu_79::CharString*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 110k | ~MaybeStackArray() { releaseArray(); } |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::ExtensionListEntry*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 60.4k | ~MaybeStackArray() { releaseArray(); } |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::AttributeListEntry*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 50.9k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<max_align_t, 7>::~MaybeStackArray() Line | Count | Source | 361 | 539k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<max_align_t, 14>::~MaybeStackArray() Line | Count | Source | 361 | 363k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::Hashtable*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 11.0k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::SpanInfo, 8>::~MaybeStackArray() Line | Count | Source | 361 | 11.9M | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>::~MaybeStackArray() Line | Count | Source | 361 | 100k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<long, 40>::~MaybeStackArray() Line | Count | Source | 361 | 5.39M | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<unsigned char, 40>::~MaybeStackArray() Line | Count | Source | 361 | 32.7k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 12.1k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<unsigned char, 20>::~MaybeStackArray() Line | Count | Source | 361 | 2.02k | ~MaybeStackArray() { releaseArray(); } |
Unexecuted instantiation: icu_79::MaybeStackArray<char, 30>::~MaybeStackArray() icu_79::MaybeStackArray<long, 2>::~MaybeStackArray() Line | Count | Source | 361 | 2.27M | ~MaybeStackArray() { releaseArray(); } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MicroPropsGenerator*, 8>::~MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MixedUnitLongNameHandler*, 8>::~MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::LongNameHandler*, 8>::~MaybeStackArray() icu_79::MaybeStackArray<icu_79::units::ConversionRateInfo*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 100 | ~MaybeStackArray() { releaseArray(); } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 8>::~MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::~MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::UnitsConverter*, 8>::~MaybeStackArray() icu_79::MaybeStackArray<icu_79::units::ConverterPreference*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 100 | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::MeasureUnit*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 100 | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 312k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<char16_t, 4>::~MaybeStackArray() Line | Count | Source | 361 | 2.91M | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>::~MaybeStackArray() Line | Count | Source | 361 | 3.09M | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 10>::~MaybeStackArray() Line | Count | Source | 361 | 104k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::units::UnitPreference*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 200 | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::units::UnitPreferenceMetadata*, 8>::~MaybeStackArray() Line | Count | Source | 361 | 100 | ~MaybeStackArray() { releaseArray(); } |
Unexecuted instantiation: icu_79::MaybeStackArray<long, 5>::~MaybeStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 4>::~MaybeStackArray() Unexecuted instantiation: units_converter.cpp:icu_79::MaybeStackArray<icu_79::units::(anonymous namespace)::UnitIndexAndDimension*, 8>::~MaybeStackArray() icu_79::MaybeStackArray<icu_79::number::impl::CompactModInfo, 12>::~MaybeStackArray() Line | Count | Source | 361 | 3.11k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<icu_79::MessagePattern::Part, 32>::~MaybeStackArray() Line | Count | Source | 361 | 48.5k | ~MaybeStackArray() { releaseArray(); } |
icu_79::MaybeStackArray<double, 8>::~MaybeStackArray() Line | Count | Source | 361 | 3.42k | ~MaybeStackArray() { releaseArray(); } |
|
362 | | /** |
363 | | * Move constructor: transfers ownership or copies the stack array. |
364 | | */ |
365 | | MaybeStackArray(MaybeStackArray<T, stackCapacity> &&src) noexcept; |
366 | | /** |
367 | | * Move assignment: transfers ownership or copies the stack array. |
368 | | */ |
369 | | MaybeStackArray<T, stackCapacity> &operator=(MaybeStackArray<T, stackCapacity> &&src) noexcept; |
370 | | /** |
371 | | * Returns the array capacity (number of T items). |
372 | | * @return array capacity |
373 | | */ |
374 | 638M | int32_t getCapacity() const { return capacity; }Unexecuted instantiation: icu_79::MaybeStackArray<char16_t, 40>::getCapacity() const icu_79::MaybeStackArray<char, 40>::getCapacity() const Line | Count | Source | 374 | 405M | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::UnicodeString*, 8>::getCapacity() const Line | Count | Source | 374 | 66.4k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<void*, 16>::getCapacity() const Line | Count | Source | 374 | 16.9M | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::FixedString*, 8>::getCapacity() const Line | Count | Source | 374 | 14.7k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<LocExtType*, 8>::getCapacity() const Line | Count | Source | 374 | 14.7k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<TypeAlias*, 8>::getCapacity() const Line | Count | Source | 374 | 2.49k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<LocExtKeyData*, 8>::getCapacity() const Line | Count | Source | 374 | 518 | int32_t getCapacity() const { return capacity; } |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::AttributeListEntry*, 8>::getCapacity() const Line | Count | Source | 374 | 15.9M | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::CharString*, 8>::getCapacity() const Line | Count | Source | 374 | 34.2M | int32_t getCapacity() const { return capacity; } |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::ExtensionListEntry*, 8>::getCapacity() const Line | Count | Source | 374 | 18.3M | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<max_align_t, 7>::getCapacity() const Line | Count | Source | 374 | 539k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<max_align_t, 14>::getCapacity() const Line | Count | Source | 374 | 363k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::Hashtable*, 8>::getCapacity() const Line | Count | Source | 374 | 62.8k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::SpanInfo, 8>::getCapacity() const Line | Count | Source | 374 | 42.8k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<long, 40>::getCapacity() const Line | Count | Source | 374 | 8.90M | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<unsigned char, 40>::getCapacity() const Line | Count | Source | 374 | 2.16M | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::getCapacity() const Line | Count | Source | 374 | 500 | int32_t getCapacity() const { return capacity; } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MixedUnitLongNameHandler*, 8>::getCapacity() const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::LongNameHandler*, 8>::getCapacity() const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MicroPropsGenerator*, 8>::getCapacity() const Unexecuted instantiation: icu_79::MaybeStackArray<long, 2>::getCapacity() const icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 10>::getCapacity() const Line | Count | Source | 374 | 969k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>::getCapacity() const Line | Count | Source | 374 | 43.3k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::units::ConversionRateInfo*, 8>::getCapacity() const Line | Count | Source | 374 | 15.5k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::units::UnitPreferenceMetadata*, 8>::getCapacity() const Line | Count | Source | 374 | 21.4k | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::units::UnitPreference*, 8>::getCapacity() const Line | Count | Source | 374 | 28.6k | int32_t getCapacity() const { return capacity; } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::UnitsConverter*, 8>::getCapacity() const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 8>::getCapacity() const Unexecuted instantiation: units_converter.cpp:icu_79::MaybeStackArray<icu_79::units::(anonymous namespace)::UnitIndexAndDimension*, 8>::getCapacity() const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnit*, 8>::getCapacity() const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::ConverterPreference*, 8>::getCapacity() const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::getCapacity() const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::CompactModInfo, 12>::getCapacity() const icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>::getCapacity() const Line | Count | Source | 374 | 63.3M | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>::getCapacity() const Line | Count | Source | 374 | 63.1M | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<icu_79::MessagePattern::Part, 32>::getCapacity() const Line | Count | Source | 374 | 7.79M | int32_t getCapacity() const { return capacity; } |
icu_79::MaybeStackArray<double, 8>::getCapacity() const Line | Count | Source | 374 | 430k | int32_t getCapacity() const { return capacity; } |
|
375 | | /** |
376 | | * Access without ownership change. |
377 | | * @return the array pointer |
378 | | */ |
379 | 1.15G | T *getAlias() const { return ptr; }Unexecuted instantiation: icu_79::MaybeStackArray<char16_t, 40>::getAlias() const icu_79::MaybeStackArray<char, 40>::getAlias() const Line | Count | Source | 379 | 1.04G | T *getAlias() const { return ptr; } |
icu_79::MaybeStackArray<void*, 16>::getAlias() const Line | Count | Source | 379 | 16.9M | T *getAlias() const { return ptr; } |
icu_79::MaybeStackArray<max_align_t, 7>::getAlias() const Line | Count | Source | 379 | 539k | T *getAlias() const { return ptr; } |
icu_79::MaybeStackArray<max_align_t, 14>::getAlias() const Line | Count | Source | 379 | 727k | T *getAlias() const { return ptr; } |
Unexecuted instantiation: icu_79::MaybeStackArray<long, 40>::getAlias() const icu_79::MaybeStackArray<unsigned char, 40>::getAlias() const Line | Count | Source | 379 | 17.8k | T *getAlias() const { return ptr; } |
icu_79::MaybeStackArray<unsigned char, 20>::getAlias() const Line | Count | Source | 379 | 2.02k | T *getAlias() const { return ptr; } |
Unexecuted instantiation: icu_79::MaybeStackArray<char, 30>::getAlias() const icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>::getAlias() const Line | Count | Source | 379 | 33.9k | T *getAlias() const { return ptr; } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::getAlias() const Unexecuted instantiation: icu_79::MaybeStackArray<long, 5>::getAlias() const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::getAlias() const icu_79::MaybeStackArray<char16_t, 4>::getAlias() const Line | Count | Source | 379 | 10.4M | T *getAlias() const { return ptr; } |
icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>::getAlias() const Line | Count | Source | 379 | 78.2M | T *getAlias() const { return ptr; } |
icu_79::MaybeStackArray<icu_79::MessagePattern::Part, 32>::getAlias() const Line | Count | Source | 379 | 97.0k | T *getAlias() const { return ptr; } |
icu_79::MaybeStackArray<double, 8>::getAlias() const Line | Count | Source | 379 | 3.42k | T *getAlias() const { return ptr; } |
|
380 | | /** |
381 | | * Returns the array limit. Simple convenience method. |
382 | | * @return getAlias()+getCapacity() |
383 | | */ |
384 | | T *getArrayLimit() const { return getAlias()+capacity; } |
385 | | // No "operator T *() const" because that can make |
386 | | // expressions like mbs[index] ambiguous for some compilers. |
387 | | /** |
388 | | * Array item access (const). |
389 | | * No index bounds check. |
390 | | * @param i array index |
391 | | * @return reference to the array item |
392 | | */ |
393 | 206M | const T &operator[](ptrdiff_t i) const { return ptr[i]; }icu_79::MaybeStackArray<char, 40>::operator[](long) const Line | Count | Source | 393 | 15.4M | const T &operator[](ptrdiff_t i) const { return ptr[i]; } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::SpanInfo, 8>::operator[](long) const icu_79::MaybeStackArray<long, 40>::operator[](long) const Line | Count | Source | 393 | 74.1M | const T &operator[](ptrdiff_t i) const { return ptr[i]; } |
Unexecuted instantiation: icu_79::MaybeStackArray<unsigned char, 40>::operator[](long) const icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::operator[](long) const Line | Count | Source | 393 | 300 | const T &operator[](ptrdiff_t i) const { return ptr[i]; } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnit*, 8>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MicroPropsGenerator*, 8>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 8>::operator[](long) const icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 10>::operator[](long) const Line | Count | Source | 393 | 117M | const T &operator[](ptrdiff_t i) const { return ptr[i]; } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>::operator[](long) const icu_79::MaybeStackArray<icu_79::units::UnitPreferenceMetadata*, 8>::operator[](long) const Line | Count | Source | 393 | 700 | const T &operator[](ptrdiff_t i) const { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::units::ConversionRateInfo*, 8>::operator[](long) const Line | Count | Source | 393 | 10.7k | const T &operator[](ptrdiff_t i) const { return ptr[i]; } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::UnitPreference*, 8>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::UnitsConverter*, 8>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::operator[](long) const Unexecuted instantiation: units_converter.cpp:icu_79::MaybeStackArray<icu_79::units::(anonymous namespace)::UnitIndexAndDimension*, 8>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::ConverterPreference*, 8>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::CompactModInfo, 12>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MessagePattern::Part, 32>::operator[](long) const |
394 | | /** |
395 | | * Array item access (writable). |
396 | | * No index bounds check. |
397 | | * @param i array index |
398 | | * @return reference to the array item |
399 | | */ |
400 | 1.03G | T &operator[](ptrdiff_t i) { return ptr[i]; }icu_79::MaybeStackArray<char, 40>::operator[](long) Line | Count | Source | 400 | 614M | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::UnicodeString*, 8>::operator[](long) Line | Count | Source | 400 | 132k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<LocExtKeyData*, 8>::operator[](long) Line | Count | Source | 400 | 518 | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<LocExtType*, 8>::operator[](long) Line | Count | Source | 400 | 14.7k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<TypeAlias*, 8>::operator[](long) Line | Count | Source | 400 | 2.49k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::FixedString*, 8>::operator[](long) Line | Count | Source | 400 | 14.7k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::AttributeListEntry*, 8>::operator[](long) Line | Count | Source | 400 | 31.9M | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::CharString*, 8>::operator[](long) Line | Count | Source | 400 | 68.4M | T &operator[](ptrdiff_t i) { return ptr[i]; } |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::ExtensionListEntry*, 8>::operator[](long) Line | Count | Source | 400 | 36.7M | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::Hashtable*, 8>::operator[](long) Line | Count | Source | 400 | 125k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::SpanInfo, 8>::operator[](long) Line | Count | Source | 400 | 42.8k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::operator[](long) Line | Count | Source | 400 | 1.50k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::units::ConversionRateInfo*, 8>::operator[](long) Line | Count | Source | 400 | 31.0k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 8>::operator[](long) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::UnitsConverter*, 8>::operator[](long) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::operator[](long) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::LongNameHandler*, 8>::operator[](long) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MixedUnitLongNameHandler*, 8>::operator[](long) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnit*, 8>::operator[](long) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::ConverterPreference*, 8>::operator[](long) icu_79::MaybeStackArray<long, 40>::operator[](long) Line | Count | Source | 400 | 76.6M | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<unsigned char, 40>::operator[](long) Line | Count | Source | 400 | 2.25M | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<unsigned char, 20>::operator[](long) Line | Count | Source | 400 | 30.1k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
Unexecuted instantiation: icu_79::MaybeStackArray<char, 30>::operator[](long) Unexecuted instantiation: icu_79::MaybeStackArray<long, 2>::operator[](long) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MicroPropsGenerator*, 8>::operator[](long) icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>::operator[](long) Line | Count | Source | 400 | 126M | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<char16_t, 4>::operator[](long) Line | Count | Source | 400 | 2.91M | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 10>::operator[](long) Line | Count | Source | 400 | 969k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>::operator[](long) Line | Count | Source | 400 | 89.9k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::units::UnitPreferenceMetadata*, 8>::operator[](long) Line | Count | Source | 400 | 85.4k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::units::UnitPreference*, 8>::operator[](long) Line | Count | Source | 400 | 57.2k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
Unexecuted instantiation: icu_79::MaybeStackArray<long, 5>::operator[](long) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 4>::operator[](long) Unexecuted instantiation: units_converter.cpp:icu_79::MaybeStackArray<icu_79::units::(anonymous namespace)::UnitIndexAndDimension*, 8>::operator[](long) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::CompactModInfo, 12>::operator[](long) icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>::operator[](long) Line | Count | Source | 400 | 63.3M | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<icu_79::MessagePattern::Part, 32>::operator[](long) Line | Count | Source | 400 | 9.82M | T &operator[](ptrdiff_t i) { return ptr[i]; } |
icu_79::MaybeStackArray<double, 8>::operator[](long) Line | Count | Source | 400 | 433k | T &operator[](ptrdiff_t i) { return ptr[i]; } |
|
401 | | /** |
402 | | * Deletes the array (if owned) and aliases another one, no transfer of ownership. |
403 | | * If the arguments are illegal, then the current array is unchanged. |
404 | | * @param otherArray must not be nullptr |
405 | | * @param otherCapacity must be >0 |
406 | | */ |
407 | | void aliasInstead(T *otherArray, int32_t otherCapacity) { |
408 | | if(otherArray!=nullptr && otherCapacity>0) { |
409 | | releaseArray(); |
410 | | ptr=otherArray; |
411 | | capacity=otherCapacity; |
412 | | needToRelease=false; |
413 | | } |
414 | | } |
415 | | /** |
416 | | * Deletes the array (if owned) and allocates a new one, copying length T items. |
417 | | * Returns the new array pointer. |
418 | | * If the allocation fails, then the current array is unchanged and |
419 | | * this method returns nullptr. |
420 | | * @param newCapacity can be less than or greater than the current capacity; |
421 | | * must be >0 |
422 | | * @param length number of T items to be copied from the old array to the new one |
423 | | * @return the allocated array pointer, or nullptr if the allocation failed |
424 | | */ |
425 | | inline T *resize(int32_t newCapacity, int32_t length=0); |
426 | | /** |
427 | | * Gives up ownership of the array if owned, or else clones it, |
428 | | * copying length T items; resets itself to the internal stack array. |
429 | | * Returns nullptr if the allocation failed. |
430 | | * @param length number of T items to copy when cloning, |
431 | | * and capacity of the clone when cloning |
432 | | * @param resultCapacity will be set to the returned array's capacity (output-only) |
433 | | * @return the array pointer; |
434 | | * caller becomes responsible for deleting the array |
435 | | */ |
436 | | inline T *orphanOrClone(int32_t length, int32_t &resultCapacity); |
437 | | |
438 | | protected: |
439 | | // Resizes the array to the size of src, then copies the contents of src. |
440 | 2.26M | void copyFrom(const MaybeStackArray &src, UErrorCode &status) { |
441 | 2.26M | if (U_FAILURE(status)) { |
442 | 0 | return; |
443 | 0 | } |
444 | 2.26M | if (this->resize(src.capacity, 0) == nullptr) { |
445 | 0 | status = U_MEMORY_ALLOCATION_ERROR; |
446 | 0 | return; |
447 | 0 | } |
448 | 2.26M | uprv_memcpy(this->ptr, src.ptr, (size_t)capacity * sizeof(T)); |
449 | 2.26M | } |
450 | | |
451 | | private: |
452 | | T *ptr; |
453 | | int32_t capacity; |
454 | | UBool needToRelease; |
455 | | T stackArray[stackCapacity]; |
456 | 191M | void releaseArray() { |
457 | 191M | if(needToRelease) { |
458 | 8.35M | uprv_free(ptr); |
459 | 8.35M | } |
460 | 191M | } Unexecuted instantiation: icu_79::MaybeStackArray<char16_t, 40>::releaseArray() icu_79::MaybeStackArray<char, 40>::releaseArray() Line | Count | Source | 456 | 136M | void releaseArray() { | 457 | 136M | if(needToRelease) { | 458 | 929k | uprv_free(ptr); | 459 | 929k | } | 460 | 136M | } |
icu_79::MaybeStackArray<icu_79::UnicodeString*, 8>::releaseArray() Line | Count | Source | 456 | 105 | void releaseArray() { | 457 | 105 | if(needToRelease) { | 458 | 81 | uprv_free(ptr); | 459 | 81 | } | 460 | 105 | } |
icu_79::MaybeStackArray<void*, 16>::releaseArray() Line | Count | Source | 456 | 21.9M | void releaseArray() { | 457 | 21.9M | if(needToRelease) { | 458 | 4.99M | uprv_free(ptr); | 459 | 4.99M | } | 460 | 21.9M | } |
icu_79::MaybeStackArray<LocExtKeyData*, 8>::releaseArray() Line | Count | Source | 456 | 28 | void releaseArray() { | 457 | 28 | if(needToRelease) { | 458 | 14 | uprv_free(ptr); | 459 | 14 | } | 460 | 28 | } |
icu_79::MaybeStackArray<LocExtType*, 8>::releaseArray() Line | Count | Source | 456 | 98 | void releaseArray() { | 457 | 98 | if(needToRelease) { | 458 | 84 | uprv_free(ptr); | 459 | 84 | } | 460 | 98 | } |
icu_79::MaybeStackArray<TypeAlias*, 8>::releaseArray() Line | Count | Source | 456 | 56 | void releaseArray() { | 457 | 56 | if(needToRelease) { | 458 | 42 | uprv_free(ptr); | 459 | 42 | } | 460 | 56 | } |
icu_79::MaybeStackArray<icu_79::FixedString*, 8>::releaseArray() Line | Count | Source | 456 | 98 | void releaseArray() { | 457 | 98 | if(needToRelease) { | 458 | 84 | uprv_free(ptr); | 459 | 84 | } | 460 | 98 | } |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::AttributeListEntry*, 8>::releaseArray() Line | Count | Source | 456 | 57.8k | void releaseArray() { | 457 | 57.8k | if(needToRelease) { | 458 | 6.88k | uprv_free(ptr); | 459 | 6.88k | } | 460 | 57.8k | } |
icu_79::MaybeStackArray<icu_79::CharString*, 8>::releaseArray() Line | Count | Source | 456 | 132k | void releaseArray() { | 457 | 132k | if(needToRelease) { | 458 | 22.2k | uprv_free(ptr); | 459 | 22.2k | } | 460 | 132k | } |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::ExtensionListEntry*, 8>::releaseArray() Line | Count | Source | 456 | 79.7k | void releaseArray() { | 457 | 79.7k | if(needToRelease) { | 458 | 19.3k | uprv_free(ptr); | 459 | 19.3k | } | 460 | 79.7k | } |
icu_79::MaybeStackArray<max_align_t, 7>::releaseArray() Line | Count | Source | 456 | 539k | void releaseArray() { | 457 | 539k | if(needToRelease) { | 458 | 0 | uprv_free(ptr); | 459 | 0 | } | 460 | 539k | } |
icu_79::MaybeStackArray<max_align_t, 14>::releaseArray() Line | Count | Source | 456 | 363k | void releaseArray() { | 457 | 363k | if(needToRelease) { | 458 | 0 | uprv_free(ptr); | 459 | 0 | } | 460 | 363k | } |
icu_79::MaybeStackArray<icu_79::Hashtable*, 8>::releaseArray() Line | Count | Source | 456 | 15.6k | void releaseArray() { | 457 | 15.6k | if(needToRelease) { | 458 | 4.55k | uprv_free(ptr); | 459 | 4.55k | } | 460 | 15.6k | } |
icu_79::MaybeStackArray<icu_79::SpanInfo, 8>::releaseArray() Line | Count | Source | 456 | 11.9M | void releaseArray() { | 457 | 11.9M | if(needToRelease) { | 458 | 0 | uprv_free(ptr); | 459 | 0 | } | 460 | 11.9M | } |
icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>::releaseArray() Line | Count | Source | 456 | 104k | void releaseArray() { | 457 | 104k | if(needToRelease) { | 458 | 3.15k | uprv_free(ptr); | 459 | 3.15k | } | 460 | 104k | } |
icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::releaseArray() Line | Count | Source | 456 | 12.1k | void releaseArray() { | 457 | 12.1k | if(needToRelease) { | 458 | 0 | uprv_free(ptr); | 459 | 0 | } | 460 | 12.1k | } |
icu_79::MaybeStackArray<icu_79::units::ConversionRateInfo*, 8>::releaseArray() Line | Count | Source | 456 | 500 | void releaseArray() { | 457 | 500 | if(needToRelease) { | 458 | 400 | uprv_free(ptr); | 459 | 400 | } | 460 | 500 | } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 8>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::UnitsConverter*, 8>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::LongNameHandler*, 8>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MixedUnitLongNameHandler*, 8>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MicroPropsGenerator*, 8>::releaseArray() icu_79::MaybeStackArray<long, 2>::releaseArray() Line | Count | Source | 456 | 4.54M | void releaseArray() { | 457 | 4.54M | if(needToRelease) { | 458 | 2.26M | uprv_free(ptr); | 459 | 2.26M | } | 460 | 4.54M | } |
icu_79::MaybeStackArray<icu_79::MeasureUnit*, 8>::releaseArray() Line | Count | Source | 456 | 100 | void releaseArray() { | 457 | 100 | if(needToRelease) { | 458 | 0 | uprv_free(ptr); | 459 | 0 | } | 460 | 100 | } |
icu_79::MaybeStackArray<icu_79::units::ConverterPreference*, 8>::releaseArray() Line | Count | Source | 456 | 100 | void releaseArray() { | 457 | 100 | if(needToRelease) { | 458 | 0 | uprv_free(ptr); | 459 | 0 | } | 460 | 100 | } |
icu_79::MaybeStackArray<long, 40>::releaseArray() Line | Count | Source | 456 | 5.39M | void releaseArray() { | 457 | 5.39M | if(needToRelease) { | 458 | 4.55k | uprv_free(ptr); | 459 | 4.55k | } | 460 | 5.39M | } |
icu_79::MaybeStackArray<unsigned char, 40>::releaseArray() Line | Count | Source | 456 | 37.7k | void releaseArray() { | 457 | 37.7k | if(needToRelease) { | 458 | 5.00k | uprv_free(ptr); | 459 | 5.00k | } | 460 | 37.7k | } |
icu_79::MaybeStackArray<unsigned char, 20>::releaseArray() Line | Count | Source | 456 | 2.02k | void releaseArray() { | 457 | 2.02k | if(needToRelease) { | 458 | 0 | uprv_free(ptr); | 459 | 0 | } | 460 | 2.02k | } |
Unexecuted instantiation: icu_79::MaybeStackArray<char, 30>::releaseArray() icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>::releaseArray() Line | Count | Source | 456 | 535k | void releaseArray() { | 457 | 535k | if(needToRelease) { | 458 | 15.1k | uprv_free(ptr); | 459 | 15.1k | } | 460 | 535k | } |
icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>::releaseArray() Line | Count | Source | 456 | 4.80M | void releaseArray() { | 457 | 4.80M | if(needToRelease) { | 458 | 46.0k | uprv_free(ptr); | 459 | 46.0k | } | 460 | 4.80M | } |
icu_79::MaybeStackArray<char16_t, 4>::releaseArray() Line | Count | Source | 456 | 4.59M | void releaseArray() { | 457 | 4.59M | if(needToRelease) { | 458 | 14.1k | uprv_free(ptr); | 459 | 14.1k | } | 460 | 4.59M | } |
icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 10>::releaseArray() Line | Count | Source | 456 | 104k | void releaseArray() { | 457 | 104k | if(needToRelease) { | 458 | 279 | uprv_free(ptr); | 459 | 279 | } | 460 | 104k | } |
icu_79::MaybeStackArray<icu_79::units::UnitPreferenceMetadata*, 8>::releaseArray() Line | Count | Source | 456 | 500 | void releaseArray() { | 457 | 500 | if(needToRelease) { | 458 | 400 | uprv_free(ptr); | 459 | 400 | } | 460 | 500 | } |
icu_79::MaybeStackArray<icu_79::units::UnitPreference*, 8>::releaseArray() Line | Count | Source | 456 | 700 | void releaseArray() { | 457 | 700 | if(needToRelease) { | 458 | 500 | uprv_free(ptr); | 459 | 500 | } | 460 | 700 | } |
Unexecuted instantiation: icu_79::MaybeStackArray<long, 5>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 4>::releaseArray() Unexecuted instantiation: units_converter.cpp:icu_79::MaybeStackArray<icu_79::units::(anonymous namespace)::UnitIndexAndDimension*, 8>::releaseArray() icu_79::MaybeStackArray<icu_79::number::impl::CompactModInfo, 12>::releaseArray() Line | Count | Source | 456 | 3.11k | void releaseArray() { | 457 | 3.11k | if(needToRelease) { | 458 | 0 | uprv_free(ptr); | 459 | 0 | } | 460 | 3.11k | } |
icu_79::MaybeStackArray<icu_79::MessagePattern::Part, 32>::releaseArray() Line | Count | Source | 456 | 60.0k | void releaseArray() { | 457 | 60.0k | if(needToRelease) { | 458 | 11.5k | uprv_free(ptr); | 459 | 11.5k | } | 460 | 60.0k | } |
icu_79::MaybeStackArray<double, 8>::releaseArray() Line | Count | Source | 456 | 4.32k | void releaseArray() { | 457 | 4.32k | if(needToRelease) { | 458 | 901 | uprv_free(ptr); | 459 | 901 | } | 460 | 4.32k | } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 8>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::UnitsConverter*, 8>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::LongNameHandler*, 8>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MixedUnitLongNameHandler*, 8>::releaseArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MicroPropsGenerator*, 8>::releaseArray() |
461 | 116k | void resetToStackArray() { |
462 | 116k | ptr=stackArray; |
463 | 116k | capacity=stackCapacity; |
464 | 116k | needToRelease=false; |
465 | 116k | } Unexecuted instantiation: icu_79::MaybeStackArray<char16_t, 40>::resetToStackArray() icu_79::MaybeStackArray<char, 40>::resetToStackArray() Line | Count | Source | 461 | 71.3k | void resetToStackArray() { | 462 | 71.3k | ptr=stackArray; | 463 | 71.3k | capacity=stackCapacity; | 464 | 71.3k | needToRelease=false; | 465 | 71.3k | } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::resetToStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 8>::resetToStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>::resetToStackArray() icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>::resetToStackArray() Line | Count | Source | 461 | 27.3k | void resetToStackArray() { | 462 | 27.3k | ptr=stackArray; | 463 | 27.3k | capacity=stackCapacity; | 464 | 27.3k | needToRelease=false; | 465 | 27.3k | } |
icu_79::MaybeStackArray<char16_t, 4>::resetToStackArray() Line | Count | Source | 461 | 14.1k | void resetToStackArray() { | 462 | 14.1k | ptr=stackArray; | 463 | 14.1k | capacity=stackCapacity; | 464 | 14.1k | needToRelease=false; | 465 | 14.1k | } |
icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>::resetToStackArray() Line | Count | Source | 461 | 3.33k | void resetToStackArray() { | 462 | 3.33k | ptr=stackArray; | 463 | 3.33k | capacity=stackCapacity; | 464 | 3.33k | needToRelease=false; | 465 | 3.33k | } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::UnitPreference*, 8>::resetToStackArray() Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::resetToStackArray() |
466 | | /* No comparison operators with other MaybeStackArray's. */ |
467 | | bool operator==(const MaybeStackArray & /*other*/) = delete; |
468 | | bool operator!=(const MaybeStackArray & /*other*/) = delete; |
469 | | /* No ownership transfer: No copy constructor, no assignment operator. */ |
470 | | MaybeStackArray(const MaybeStackArray & /*other*/) = delete; |
471 | | void operator=(const MaybeStackArray & /*other*/) = delete; |
472 | | }; |
473 | | |
474 | | template<typename T, int32_t stackCapacity> |
475 | | icu::MaybeStackArray<T, stackCapacity>::MaybeStackArray( |
476 | | MaybeStackArray <T, stackCapacity>&& src) noexcept |
477 | 2.15M | : ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) { |
478 | 2.15M | if (src.ptr == src.stackArray) { |
479 | 2.14M | ptr = stackArray; |
480 | 2.14M | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); |
481 | 2.14M | } else { |
482 | 17.0k | src.resetToStackArray(); // take ownership away from src |
483 | 17.0k | } |
484 | 2.15M | } icu_79::MaybeStackArray<char, 40>::MaybeStackArray(icu_79::MaybeStackArray<char, 40>&&) Line | Count | Source | 477 | 1.81M | : ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) { | 478 | 1.81M | if (src.ptr == src.stackArray) { | 479 | 1.81M | ptr = stackArray; | 480 | 1.81M | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); | 481 | 1.81M | } else { | 482 | 0 | src.resetToStackArray(); // take ownership away from src | 483 | 0 | } | 484 | 1.81M | } |
icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::MaybeStackArray(icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>&&) Line | Count | Source | 477 | 100 | : ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) { | 478 | 100 | if (src.ptr == src.stackArray) { | 479 | 100 | ptr = stackArray; | 480 | 100 | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); | 481 | 100 | } else { | 482 | 0 | src.resetToStackArray(); // take ownership away from src | 483 | 0 | } | 484 | 100 | } |
icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>::MaybeStackArray(icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>&&) Line | Count | Source | 477 | 104k | : ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) { | 478 | 104k | if (src.ptr == src.stackArray) { | 479 | 104k | ptr = stackArray; | 480 | 104k | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); | 481 | 104k | } else { | 482 | 0 | src.resetToStackArray(); // take ownership away from src | 483 | 0 | } | 484 | 104k | } |
icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>::MaybeStackArray(icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>&&) Line | Count | Source | 477 | 51.3k | : ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) { | 478 | 51.3k | if (src.ptr == src.stackArray) { | 479 | 48.0k | ptr = stackArray; | 480 | 48.0k | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); | 481 | 48.0k | } else { | 482 | 3.33k | src.resetToStackArray(); // take ownership away from src | 483 | 3.33k | } | 484 | 51.3k | } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::MaybeStackArray(icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>&&) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 8>::MaybeStackArray(icu_79::MaybeStackArray<icu_79::Measure*, 8>&&) icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>::MaybeStackArray(icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>&&) Line | Count | Source | 477 | 184k | : ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) { | 478 | 184k | if (src.ptr == src.stackArray) { | 479 | 170k | ptr = stackArray; | 480 | 170k | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); | 481 | 170k | } else { | 482 | 13.6k | src.resetToStackArray(); // take ownership away from src | 483 | 13.6k | } | 484 | 184k | } |
|
485 | | |
486 | | template<typename T, int32_t stackCapacity> |
487 | | inline MaybeStackArray <T, stackCapacity>& |
488 | 5.20M | MaybeStackArray<T, stackCapacity>::operator=(MaybeStackArray <T, stackCapacity>&& src) noexcept { |
489 | 5.20M | releaseArray(); // in case this instance had its own memory allocated |
490 | 5.20M | capacity = src.capacity; |
491 | 5.20M | needToRelease = src.needToRelease; |
492 | 5.20M | if (src.ptr == src.stackArray) { |
493 | 5.10M | ptr = stackArray; |
494 | 5.10M | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); |
495 | 5.10M | } else { |
496 | 99.1k | ptr = src.ptr; |
497 | 99.1k | src.resetToStackArray(); // take ownership away from src |
498 | 99.1k | } |
499 | 5.20M | return *this; |
500 | 5.20M | } icu_79::MaybeStackArray<char, 40>::operator=(icu_79::MaybeStackArray<char, 40>&&) Line | Count | Source | 488 | 1.66M | MaybeStackArray<T, stackCapacity>::operator=(MaybeStackArray <T, stackCapacity>&& src) noexcept { | 489 | 1.66M | releaseArray(); // in case this instance had its own memory allocated | 490 | 1.66M | capacity = src.capacity; | 491 | 1.66M | needToRelease = src.needToRelease; | 492 | 1.66M | if (src.ptr == src.stackArray) { | 493 | 1.59M | ptr = stackArray; | 494 | 1.59M | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); | 495 | 1.59M | } else { | 496 | 71.3k | ptr = src.ptr; | 497 | 71.3k | src.resetToStackArray(); // take ownership away from src | 498 | 71.3k | } | 499 | 1.66M | return *this; | 500 | 1.66M | } |
icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>::operator=(icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>&&) Line | Count | Source | 488 | 208k | MaybeStackArray<T, stackCapacity>::operator=(MaybeStackArray <T, stackCapacity>&& src) noexcept { | 489 | 208k | releaseArray(); // in case this instance had its own memory allocated | 490 | 208k | capacity = src.capacity; | 491 | 208k | needToRelease = src.needToRelease; | 492 | 208k | if (src.ptr == src.stackArray) { | 493 | 208k | ptr = stackArray; | 494 | 208k | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); | 495 | 208k | } else { | 496 | 0 | ptr = src.ptr; | 497 | 0 | src.resetToStackArray(); // take ownership away from src | 498 | 0 | } | 499 | 208k | return *this; | 500 | 208k | } |
icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>::operator=(icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>&&) Line | Count | Source | 488 | 1.66M | MaybeStackArray<T, stackCapacity>::operator=(MaybeStackArray <T, stackCapacity>&& src) noexcept { | 489 | 1.66M | releaseArray(); // in case this instance had its own memory allocated | 490 | 1.66M | capacity = src.capacity; | 491 | 1.66M | needToRelease = src.needToRelease; | 492 | 1.66M | if (src.ptr == src.stackArray) { | 493 | 1.65M | ptr = stackArray; | 494 | 1.65M | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); | 495 | 1.65M | } else { | 496 | 13.6k | ptr = src.ptr; | 497 | 13.6k | src.resetToStackArray(); // take ownership away from src | 498 | 13.6k | } | 499 | 1.66M | return *this; | 500 | 1.66M | } |
icu_79::MaybeStackArray<char16_t, 4>::operator=(icu_79::MaybeStackArray<char16_t, 4>&&) Line | Count | Source | 488 | 1.66M | MaybeStackArray<T, stackCapacity>::operator=(MaybeStackArray <T, stackCapacity>&& src) noexcept { | 489 | 1.66M | releaseArray(); // in case this instance had its own memory allocated | 490 | 1.66M | capacity = src.capacity; | 491 | 1.66M | needToRelease = src.needToRelease; | 492 | 1.66M | if (src.ptr == src.stackArray) { | 493 | 1.65M | ptr = stackArray; | 494 | 1.65M | uprv_memcpy(stackArray, src.stackArray, sizeof(T) * src.capacity); | 495 | 1.65M | } else { | 496 | 14.1k | ptr = src.ptr; | 497 | 14.1k | src.resetToStackArray(); // take ownership away from src | 498 | 14.1k | } | 499 | 1.66M | return *this; | 500 | 1.66M | } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::operator=(icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>&&) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::operator=(icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>&&) |
501 | | |
502 | | template<typename T, int32_t stackCapacity> |
503 | 8.35M | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { |
504 | 8.35M | if(newCapacity>0) { |
505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) |
506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); |
507 | | #endif |
508 | 8.35M | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); |
509 | 8.35M | if(p!=nullptr) { |
510 | 8.35M | if(length>0) { |
511 | 1.06M | if(length>capacity) { |
512 | 0 | length=capacity; |
513 | 0 | } |
514 | 1.06M | if(length>newCapacity) { |
515 | 0 | length=newCapacity; |
516 | 0 | } |
517 | 1.06M | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); |
518 | 1.06M | } |
519 | 8.35M | releaseArray(); |
520 | 8.35M | ptr=p; |
521 | 8.35M | capacity=newCapacity; |
522 | 8.35M | needToRelease=true; |
523 | 8.35M | } |
524 | 8.35M | return p; |
525 | 8.35M | } else { |
526 | 0 | return nullptr; |
527 | 0 | } |
528 | 8.35M | } Unexecuted instantiation: icu_79::MaybeStackArray<char16_t, 40>::resize(int, int) icu_79::MaybeStackArray<char, 40>::resize(int, int) Line | Count | Source | 503 | 929k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 929k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 929k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 929k | if(p!=nullptr) { | 510 | 929k | if(length>0) { | 511 | 929k | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 929k | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 929k | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 929k | } | 519 | 929k | releaseArray(); | 520 | 929k | ptr=p; | 521 | 929k | capacity=newCapacity; | 522 | 929k | needToRelease=true; | 523 | 929k | } | 524 | 929k | return p; | 525 | 929k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 929k | } |
icu_79::MaybeStackArray<icu_79::UnicodeString*, 8>::resize(int, int) Line | Count | Source | 503 | 81 | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 81 | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 81 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 81 | if(p!=nullptr) { | 510 | 81 | if(length>0) { | 511 | 81 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 81 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 81 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 81 | } | 519 | 81 | releaseArray(); | 520 | 81 | ptr=p; | 521 | 81 | capacity=newCapacity; | 522 | 81 | needToRelease=true; | 523 | 81 | } | 524 | 81 | return p; | 525 | 81 | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 81 | } |
icu_79::MaybeStackArray<void*, 16>::resize(int, int) Line | Count | Source | 503 | 4.99M | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 4.99M | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 4.99M | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 4.99M | if(p!=nullptr) { | 510 | 4.99M | if(length>0) { | 511 | 0 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 0 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 0 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 0 | } | 519 | 4.99M | releaseArray(); | 520 | 4.99M | ptr=p; | 521 | 4.99M | capacity=newCapacity; | 522 | 4.99M | needToRelease=true; | 523 | 4.99M | } | 524 | 4.99M | return p; | 525 | 4.99M | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 4.99M | } |
icu_79::MaybeStackArray<icu_79::FixedString*, 8>::resize(int, int) Line | Count | Source | 503 | 98 | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 98 | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 98 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 98 | if(p!=nullptr) { | 510 | 98 | if(length>0) { | 511 | 98 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 98 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 98 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 98 | } | 519 | 98 | releaseArray(); | 520 | 98 | ptr=p; | 521 | 98 | capacity=newCapacity; | 522 | 98 | needToRelease=true; | 523 | 98 | } | 524 | 98 | return p; | 525 | 98 | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 98 | } |
icu_79::MaybeStackArray<LocExtType*, 8>::resize(int, int) Line | Count | Source | 503 | 98 | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 98 | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 98 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 98 | if(p!=nullptr) { | 510 | 98 | if(length>0) { | 511 | 98 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 98 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 98 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 98 | } | 519 | 98 | releaseArray(); | 520 | 98 | ptr=p; | 521 | 98 | capacity=newCapacity; | 522 | 98 | needToRelease=true; | 523 | 98 | } | 524 | 98 | return p; | 525 | 98 | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 98 | } |
icu_79::MaybeStackArray<TypeAlias*, 8>::resize(int, int) Line | Count | Source | 503 | 56 | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 56 | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 56 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 56 | if(p!=nullptr) { | 510 | 56 | if(length>0) { | 511 | 56 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 56 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 56 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 56 | } | 519 | 56 | releaseArray(); | 520 | 56 | ptr=p; | 521 | 56 | capacity=newCapacity; | 522 | 56 | needToRelease=true; | 523 | 56 | } | 524 | 56 | return p; | 525 | 56 | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 56 | } |
icu_79::MaybeStackArray<LocExtKeyData*, 8>::resize(int, int) Line | Count | Source | 503 | 28 | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 28 | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 28 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 28 | if(p!=nullptr) { | 510 | 28 | if(length>0) { | 511 | 28 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 28 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 28 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 28 | } | 519 | 28 | releaseArray(); | 520 | 28 | ptr=p; | 521 | 28 | capacity=newCapacity; | 522 | 28 | needToRelease=true; | 523 | 28 | } | 524 | 28 | return p; | 525 | 28 | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 28 | } |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::AttributeListEntry*, 8>::resize(int, int) Line | Count | Source | 503 | 6.88k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 6.88k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 6.88k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 6.88k | if(p!=nullptr) { | 510 | 6.88k | if(length>0) { | 511 | 6.88k | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 6.88k | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 6.88k | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 6.88k | } | 519 | 6.88k | releaseArray(); | 520 | 6.88k | ptr=p; | 521 | 6.88k | capacity=newCapacity; | 522 | 6.88k | needToRelease=true; | 523 | 6.88k | } | 524 | 6.88k | return p; | 525 | 6.88k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 6.88k | } |
icu_79::MaybeStackArray<icu_79::CharString*, 8>::resize(int, int) Line | Count | Source | 503 | 22.2k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 22.2k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 22.2k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 22.2k | if(p!=nullptr) { | 510 | 22.2k | if(length>0) { | 511 | 22.2k | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 22.2k | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 22.2k | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 22.2k | } | 519 | 22.2k | releaseArray(); | 520 | 22.2k | ptr=p; | 521 | 22.2k | capacity=newCapacity; | 522 | 22.2k | needToRelease=true; | 523 | 22.2k | } | 524 | 22.2k | return p; | 525 | 22.2k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 22.2k | } |
uloc_tag.cpp:icu_79::MaybeStackArray<(anonymous namespace)::ExtensionListEntry*, 8>::resize(int, int) Line | Count | Source | 503 | 19.3k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 19.3k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 19.3k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 19.3k | if(p!=nullptr) { | 510 | 19.3k | if(length>0) { | 511 | 19.3k | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 19.3k | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 19.3k | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 19.3k | } | 519 | 19.3k | releaseArray(); | 520 | 19.3k | ptr=p; | 521 | 19.3k | capacity=newCapacity; | 522 | 19.3k | needToRelease=true; | 523 | 19.3k | } | 524 | 19.3k | return p; | 525 | 19.3k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 19.3k | } |
Unexecuted instantiation: icu_79::MaybeStackArray<max_align_t, 7>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<max_align_t, 14>::resize(int, int) icu_79::MaybeStackArray<icu_79::Hashtable*, 8>::resize(int, int) Line | Count | Source | 503 | 4.55k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 4.55k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 4.55k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 4.55k | if(p!=nullptr) { | 510 | 4.55k | if(length>0) { | 511 | 4.55k | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 4.55k | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 4.55k | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 4.55k | } | 519 | 4.55k | releaseArray(); | 520 | 4.55k | ptr=p; | 521 | 4.55k | capacity=newCapacity; | 522 | 4.55k | needToRelease=true; | 523 | 4.55k | } | 524 | 4.55k | return p; | 525 | 4.55k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 4.55k | } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::SpanInfo, 8>::resize(int, int) icu_79::MaybeStackArray<long, 2>::resize(int, int) Line | Count | Source | 503 | 2.26M | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 2.26M | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 2.26M | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 2.26M | if(p!=nullptr) { | 510 | 2.26M | if(length>0) { | 511 | 0 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 0 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 0 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 0 | } | 519 | 2.26M | releaseArray(); | 520 | 2.26M | ptr=p; | 521 | 2.26M | capacity=newCapacity; | 522 | 2.26M | needToRelease=true; | 523 | 2.26M | } | 524 | 2.26M | return p; | 525 | 2.26M | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 2.26M | } |
icu_79::MaybeStackArray<long, 40>::resize(int, int) Line | Count | Source | 503 | 4.55k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 4.55k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 4.55k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 4.55k | if(p!=nullptr) { | 510 | 4.55k | if(length>0) { | 511 | 4.55k | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 4.55k | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 4.55k | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 4.55k | } | 519 | 4.55k | releaseArray(); | 520 | 4.55k | ptr=p; | 521 | 4.55k | capacity=newCapacity; | 522 | 4.55k | needToRelease=true; | 523 | 4.55k | } | 524 | 4.55k | return p; | 525 | 4.55k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 4.55k | } |
icu_79::MaybeStackArray<unsigned char, 40>::resize(int, int) Line | Count | Source | 503 | 5.00k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 5.00k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 5.00k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 5.00k | if(p!=nullptr) { | 510 | 5.00k | if(length>0) { | 511 | 5.00k | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 5.00k | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 5.00k | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 5.00k | } | 519 | 5.00k | releaseArray(); | 520 | 5.00k | ptr=p; | 521 | 5.00k | capacity=newCapacity; | 522 | 5.00k | needToRelease=true; | 523 | 5.00k | } | 524 | 5.00k | return p; | 525 | 5.00k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 5.00k | } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::SingleUnitImpl*, 8>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<unsigned char, 20>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<char, 30>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MicroPropsGenerator*, 8>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::MixedUnitLongNameHandler*, 8>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::LongNameHandler*, 8>::resize(int, int) icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 10>::resize(int, int) Line | Count | Source | 503 | 279 | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 279 | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 279 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 279 | if(p!=nullptr) { | 510 | 279 | if(length>0) { | 511 | 279 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 279 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 279 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 279 | } | 519 | 279 | releaseArray(); | 520 | 279 | ptr=p; | 521 | 279 | capacity=newCapacity; | 522 | 279 | needToRelease=true; | 523 | 279 | } | 524 | 279 | return p; | 525 | 279 | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 279 | } |
icu_79::MaybeStackArray<icu_79::StandardPluralRanges::StandardPluralRangeTriple, 3>::resize(int, int) Line | Count | Source | 503 | 3.33k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 3.33k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 3.33k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 3.33k | if(p!=nullptr) { | 510 | 3.33k | if(length>0) { | 511 | 0 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 0 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 0 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 0 | } | 519 | 3.33k | releaseArray(); | 520 | 3.33k | ptr=p; | 521 | 3.33k | capacity=newCapacity; | 522 | 3.33k | needToRelease=true; | 523 | 3.33k | } | 524 | 3.33k | return p; | 525 | 3.33k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 3.33k | } |
icu_79::MaybeStackArray<icu_79::units::ConversionRateInfo*, 8>::resize(int, int) Line | Count | Source | 503 | 400 | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 400 | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 400 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 400 | if(p!=nullptr) { | 510 | 400 | if(length>0) { | 511 | 400 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 400 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 400 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 400 | } | 519 | 400 | releaseArray(); | 520 | 400 | ptr=p; | 521 | 400 | capacity=newCapacity; | 522 | 400 | needToRelease=true; | 523 | 400 | } | 524 | 400 | return p; | 525 | 400 | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 400 | } |
icu_79::MaybeStackArray<icu_79::units::UnitPreferenceMetadata*, 8>::resize(int, int) Line | Count | Source | 503 | 400 | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 400 | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 400 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 400 | if(p!=nullptr) { | 510 | 400 | if(length>0) { | 511 | 400 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 400 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 400 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 400 | } | 519 | 400 | releaseArray(); | 520 | 400 | ptr=p; | 521 | 400 | capacity=newCapacity; | 522 | 400 | needToRelease=true; | 523 | 400 | } | 524 | 400 | return p; | 525 | 400 | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 400 | } |
icu_79::MaybeStackArray<icu_79::units::UnitPreference*, 8>::resize(int, int) Line | Count | Source | 503 | 500 | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 500 | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 500 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 500 | if(p!=nullptr) { | 510 | 500 | if(length>0) { | 511 | 500 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 500 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 500 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 500 | } | 519 | 500 | releaseArray(); | 520 | 500 | ptr=p; | 521 | 500 | capacity=newCapacity; | 522 | 500 | needToRelease=true; | 523 | 500 | } | 524 | 500 | return p; | 525 | 500 | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 500 | } |
Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::UnitsConverter*, 8>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<long, 5>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 4>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::Measure*, 8>::resize(int, int) Unexecuted instantiation: units_converter.cpp:icu_79::MaybeStackArray<icu_79::units::(anonymous namespace)::UnitIndexAndDimension*, 8>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnit*, 8>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::units::ConverterPreference*, 8>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::MeasureUnitImplWithIndex*, 8>::resize(int, int) Unexecuted instantiation: icu_79::MaybeStackArray<icu_79::number::impl::CompactModInfo, 12>::resize(int, int) icu_79::MaybeStackArray<icu_79::numparse::impl::NumberParseMatcher const*, 3>::resize(int, int) Line | Count | Source | 503 | 46.0k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 46.0k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 46.0k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 46.0k | if(p!=nullptr) { | 510 | 46.0k | if(length>0) { | 511 | 46.0k | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 46.0k | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 46.0k | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 46.0k | } | 519 | 46.0k | releaseArray(); | 520 | 46.0k | ptr=p; | 521 | 46.0k | capacity=newCapacity; | 522 | 46.0k | needToRelease=true; | 523 | 46.0k | } | 524 | 46.0k | return p; | 525 | 46.0k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 46.0k | } |
icu_79::MaybeStackArray<icu_79::numparse::impl::CodePointMatcher*, 8>::resize(int, int) Line | Count | Source | 503 | 15.1k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 15.1k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 15.1k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 15.1k | if(p!=nullptr) { | 510 | 15.1k | if(length>0) { | 511 | 15.1k | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 15.1k | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 15.1k | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 15.1k | } | 519 | 15.1k | releaseArray(); | 520 | 15.1k | ptr=p; | 521 | 15.1k | capacity=newCapacity; | 522 | 15.1k | needToRelease=true; | 523 | 15.1k | } | 524 | 15.1k | return p; | 525 | 15.1k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 15.1k | } |
icu_79::MaybeStackArray<char16_t, 4>::resize(int, int) Line | Count | Source | 503 | 14.1k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 14.1k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 14.1k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 14.1k | if(p!=nullptr) { | 510 | 14.1k | if(length>0) { | 511 | 0 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 0 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 0 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 0 | } | 519 | 14.1k | releaseArray(); | 520 | 14.1k | ptr=p; | 521 | 14.1k | capacity=newCapacity; | 522 | 14.1k | needToRelease=true; | 523 | 14.1k | } | 524 | 14.1k | return p; | 525 | 14.1k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 14.1k | } |
icu_79::MaybeStackArray<icu_79::MessagePattern::Part, 32>::resize(int, int) Line | Count | Source | 503 | 11.5k | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 11.5k | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 11.5k | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 11.5k | if(p!=nullptr) { | 510 | 11.5k | if(length>0) { | 511 | 11.5k | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 11.5k | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 11.5k | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 11.5k | } | 519 | 11.5k | releaseArray(); | 520 | 11.5k | ptr=p; | 521 | 11.5k | capacity=newCapacity; | 522 | 11.5k | needToRelease=true; | 523 | 11.5k | } | 524 | 11.5k | return p; | 525 | 11.5k | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 11.5k | } |
icu_79::MaybeStackArray<double, 8>::resize(int, int) Line | Count | Source | 503 | 901 | inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) { | 504 | 901 | if(newCapacity>0) { | 505 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) | 506 | | ::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T)); | 507 | | #endif | 508 | 901 | T *p=(T *)uprv_malloc(newCapacity*sizeof(T)); | 509 | 901 | if(p!=nullptr) { | 510 | 901 | if(length>0) { | 511 | 901 | if(length>capacity) { | 512 | 0 | length=capacity; | 513 | 0 | } | 514 | 901 | if(length>newCapacity) { | 515 | 0 | length=newCapacity; | 516 | 0 | } | 517 | 901 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); | 518 | 901 | } | 519 | 901 | releaseArray(); | 520 | 901 | ptr=p; | 521 | 901 | capacity=newCapacity; | 522 | 901 | needToRelease=true; | 523 | 901 | } | 524 | 901 | return p; | 525 | 901 | } else { | 526 | 0 | return nullptr; | 527 | 0 | } | 528 | 901 | } |
Unexecuted instantiation: icu_79::MaybeStackArray<long, 2>::resize(int, int) |
529 | | |
530 | | template<typename T, int32_t stackCapacity> |
531 | 0 | inline T *MaybeStackArray<T, stackCapacity>::orphanOrClone(int32_t length, int32_t &resultCapacity) { |
532 | 0 | T *p; |
533 | 0 | if(needToRelease) { |
534 | 0 | p=ptr; |
535 | 0 | } else if(length<=0) { |
536 | 0 | return nullptr; |
537 | 0 | } else { |
538 | 0 | if(length>capacity) { |
539 | 0 | length=capacity; |
540 | 0 | } |
541 | 0 | p=(T *)uprv_malloc(length*sizeof(T)); |
542 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) |
543 | | ::fprintf(::stderr,"MaybeStacArray (orphan) alloc %d * %lu\n", length,sizeof(T)); |
544 | | #endif |
545 | 0 | if(p==nullptr) { |
546 | 0 | return nullptr; |
547 | 0 | } |
548 | 0 | uprv_memcpy(p, ptr, (size_t)length*sizeof(T)); |
549 | 0 | } |
550 | 0 | resultCapacity=length; |
551 | 0 | resetToStackArray(); |
552 | 0 | return p; |
553 | 0 | } |
554 | | |
555 | | /** |
556 | | * Variant of MaybeStackArray that allocates a header struct and an array |
557 | | * in one contiguous memory block, using uprv_malloc() and uprv_free(). |
558 | | * Provides internal memory with fixed array capacity. Can alias another memory |
559 | | * block or allocate one. |
560 | | * The stackCapacity is the number of T items in the internal memory, |
561 | | * not counting the H header. |
562 | | * Unlike LocalMemory and LocalArray, this class never adopts |
563 | | * (takes ownership of) another memory block. |
564 | | */ |
565 | | template<typename H, typename T, int32_t stackCapacity> |
566 | | class MaybeStackHeaderAndArray { |
567 | | public: |
568 | | // No heap allocation. Use only on the stack. |
569 | | static void* U_EXPORT2 operator new(size_t) noexcept = delete; |
570 | | static void* U_EXPORT2 operator new[](size_t) noexcept = delete; |
571 | | static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete; |
572 | | |
573 | | /** |
574 | | * Default constructor initializes with internal H+T[stackCapacity] buffer. |
575 | | */ |
576 | 9.43k | MaybeStackHeaderAndArray() : ptr(&stackHeader), capacity(stackCapacity), needToRelease(false) {} |
577 | | /** |
578 | | * Destructor deletes the memory (if owned). |
579 | | */ |
580 | 9.43k | ~MaybeStackHeaderAndArray() { releaseMemory(); } |
581 | | /** |
582 | | * Returns the array capacity (number of T items). |
583 | | * @return array capacity |
584 | | */ |
585 | | int32_t getCapacity() const { return capacity; } |
586 | | /** |
587 | | * Access without ownership change. |
588 | | * @return the header pointer |
589 | | */ |
590 | 55.7k | H *getAlias() const { return ptr; } |
591 | | /** |
592 | | * Returns the array start. |
593 | | * @return array start, same address as getAlias()+1 |
594 | | */ |
595 | 16.5k | T *getArrayStart() const { return reinterpret_cast<T *>(getAlias()+1); } |
596 | | /** |
597 | | * Returns the array limit. |
598 | | * @return array limit |
599 | | */ |
600 | 4.13k | T *getArrayLimit() const { return getArrayStart()+capacity; } |
601 | | /** |
602 | | * Access without ownership change. Same as getAlias(). |
603 | | * A class instance can be used directly in expressions that take a T *. |
604 | | * @return the header pointer |
605 | | */ |
606 | 10.7k | operator H *() const { return ptr; } |
607 | | /** |
608 | | * Array item access (writable). |
609 | | * No index bounds check. |
610 | | * @param i array index |
611 | | * @return reference to the array item |
612 | | */ |
613 | | T &operator[](ptrdiff_t i) { return getArrayStart()[i]; } |
614 | | /** |
615 | | * Deletes the memory block (if owned) and aliases another one, no transfer of ownership. |
616 | | * If the arguments are illegal, then the current memory is unchanged. |
617 | | * @param otherArray must not be nullptr |
618 | | * @param otherCapacity must be >0 |
619 | | */ |
620 | | void aliasInstead(H *otherMemory, int32_t otherCapacity) { |
621 | | if(otherMemory!=nullptr && otherCapacity>0) { |
622 | | releaseMemory(); |
623 | | ptr=otherMemory; |
624 | | capacity=otherCapacity; |
625 | | needToRelease=false; |
626 | | } |
627 | | } |
628 | | /** |
629 | | * Deletes the memory block (if owned) and allocates a new one, |
630 | | * copying the header and length T array items. |
631 | | * Returns the new header pointer. |
632 | | * If the allocation fails, then the current memory is unchanged and |
633 | | * this method returns nullptr. |
634 | | * @param newCapacity can be less than or greater than the current capacity; |
635 | | * must be >0 |
636 | | * @param length number of T items to be copied from the old array to the new one |
637 | | * @return the allocated pointer, or nullptr if the allocation failed |
638 | | */ |
639 | | inline H *resize(int32_t newCapacity, int32_t length=0); |
640 | | /** |
641 | | * Gives up ownership of the memory if owned, or else clones it, |
642 | | * copying the header and length T array items; resets itself to the internal memory. |
643 | | * Returns nullptr if the allocation failed. |
644 | | * @param length number of T items to copy when cloning, |
645 | | * and array capacity of the clone when cloning |
646 | | * @param resultCapacity will be set to the returned array's capacity (output-only) |
647 | | * @return the header pointer; |
648 | | * caller becomes responsible for deleting the array |
649 | | */ |
650 | | inline H *orphanOrClone(int32_t length, int32_t &resultCapacity); |
651 | | private: |
652 | | H *ptr; |
653 | | int32_t capacity; |
654 | | UBool needToRelease; |
655 | | // stackHeader must precede stackArray immediately. |
656 | | H stackHeader; |
657 | | T stackArray[stackCapacity]; |
658 | 10.5k | void releaseMemory() { |
659 | 10.5k | if(needToRelease) { |
660 | 1.16k | uprv_free(ptr); |
661 | 1.16k | } |
662 | 10.5k | } |
663 | | /* No comparison operators with other MaybeStackHeaderAndArray's. */ |
664 | | bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return false;} |
665 | | bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return true;} |
666 | | /* No ownership transfer: No copy constructor, no assignment operator. */ |
667 | | MaybeStackHeaderAndArray(const MaybeStackHeaderAndArray & /*other*/) {} |
668 | | void operator=(const MaybeStackHeaderAndArray & /*other*/) {} |
669 | | }; |
670 | | |
671 | | template<typename H, typename T, int32_t stackCapacity> |
672 | | inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::resize(int32_t newCapacity, |
673 | 1.16k | int32_t length) { |
674 | 1.16k | if(newCapacity>=0) { |
675 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) |
676 | | ::fprintf(::stderr,"MaybeStackHeaderAndArray alloc %d + %d * %ul\n", sizeof(H),newCapacity,sizeof(T)); |
677 | | #endif |
678 | 1.16k | H *p=(H *)uprv_malloc(sizeof(H)+newCapacity*sizeof(T)); |
679 | 1.16k | if(p!=nullptr) { |
680 | 1.16k | if(length<0) { |
681 | 0 | length=0; |
682 | 1.16k | } else if(length>0) { |
683 | 0 | if(length>capacity) { |
684 | 0 | length=capacity; |
685 | 0 | } |
686 | 0 | if(length>newCapacity) { |
687 | 0 | length=newCapacity; |
688 | 0 | } |
689 | 0 | } |
690 | 1.16k | uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T)); |
691 | 1.16k | releaseMemory(); |
692 | 1.16k | ptr=p; |
693 | 1.16k | capacity=newCapacity; |
694 | 1.16k | needToRelease=true; |
695 | 1.16k | } |
696 | 1.16k | return p; |
697 | 1.16k | } else { |
698 | 0 | return nullptr; |
699 | 0 | } |
700 | 1.16k | } |
701 | | |
702 | | template<typename H, typename T, int32_t stackCapacity> |
703 | | inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::orphanOrClone(int32_t length, |
704 | | int32_t &resultCapacity) { |
705 | | H *p; |
706 | | if(needToRelease) { |
707 | | p=ptr; |
708 | | } else { |
709 | | if(length<0) { |
710 | | length=0; |
711 | | } else if(length>capacity) { |
712 | | length=capacity; |
713 | | } |
714 | | #if U_DEBUG && defined(UPRV_MALLOC_COUNT) |
715 | | ::fprintf(::stderr,"MaybeStackHeaderAndArray (orphan) alloc %ul + %d * %lu\n", sizeof(H),length,sizeof(T)); |
716 | | #endif |
717 | | p=(H *)uprv_malloc(sizeof(H)+length*sizeof(T)); |
718 | | if(p==nullptr) { |
719 | | return nullptr; |
720 | | } |
721 | | uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T)); |
722 | | } |
723 | | resultCapacity=length; |
724 | | ptr=&stackHeader; |
725 | | capacity=stackCapacity; |
726 | | needToRelease=false; |
727 | | return p; |
728 | | } |
729 | | |
730 | | /** |
731 | | * A simple memory management class that creates new heap allocated objects (of |
732 | | * any class that has a public constructor), keeps track of them and eventually |
733 | | * deletes them all in its own destructor. |
734 | | * |
735 | | * A typical use-case would be code like this: |
736 | | * |
737 | | * MemoryPool<MyType> pool; |
738 | | * |
739 | | * MyType* o1 = pool.create(); |
740 | | * if (o1 != nullptr) { |
741 | | * foo(o1); |
742 | | * } |
743 | | * |
744 | | * MyType* o2 = pool.create(1, 2, 3); |
745 | | * if (o2 != nullptr) { |
746 | | * bar(o2); |
747 | | * } |
748 | | * |
749 | | * // MemoryPool will take care of deleting the MyType objects. |
750 | | * |
751 | | * It doesn't do anything more than that, and is intentionally kept minimalist. |
752 | | */ |
753 | | template<typename T, int32_t stackCapacity = 8> |
754 | | class MemoryPool : public UMemory { |
755 | | public: |
756 | 453k | MemoryPool() : fCount(0), fPool() {}icu_79::MemoryPool<icu_79::UnicodeString, 8>::MemoryPool() Line | Count | Source | 756 | 24 | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<icu_79::FixedString, 8>::MemoryPool() Line | Count | Source | 756 | 14 | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<LocExtKeyData, 8>::MemoryPool() Line | Count | Source | 756 | 14 | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<LocExtType, 8>::MemoryPool() Line | Count | Source | 756 | 14 | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<TypeAlias, 8>::MemoryPool() Line | Count | Source | 756 | 14 | MemoryPool() : fCount(0), fPool() {} |
uloc_tag.cpp:icu_79::MemoryPool<(anonymous namespace)::AttributeListEntry, 8>::MemoryPool() Line | Count | Source | 756 | 50.9k | MemoryPool() : fCount(0), fPool() {} |
uloc_tag.cpp:icu_79::MemoryPool<(anonymous namespace)::ExtensionListEntry, 8>::MemoryPool() Line | Count | Source | 756 | 60.4k | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<icu_79::CharString, 8>::MemoryPool() Line | Count | Source | 756 | 110k | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<icu_79::Hashtable, 8>::MemoryPool() Line | Count | Source | 756 | 11.0k | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<icu_79::SingleUnitImpl, 8>::MemoryPool() Line | Count | Source | 756 | 12.0k | MemoryPool() : fCount(0), fPool() {} |
Unexecuted instantiation: icu_79::MemoryPool<icu_79::number::impl::LongNameHandler, 8>::MemoryPool() Unexecuted instantiation: icu_79::MemoryPool<icu_79::number::impl::MixedUnitLongNameHandler, 8>::MemoryPool() icu_79::MemoryPool<icu_79::units::ConversionRateInfo, 8>::MemoryPool() Line | Count | Source | 756 | 100 | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<icu_79::numparse::impl::CodePointMatcher, 8>::MemoryPool() Line | Count | Source | 756 | 208k | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<icu_79::units::UnitPreferenceMetadata, 8>::MemoryPool() Line | Count | Source | 756 | 100 | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<icu_79::units::UnitPreference, 8>::MemoryPool() Line | Count | Source | 756 | 200 | MemoryPool() : fCount(0), fPool() {} |
Unexecuted instantiation: icu_79::MemoryPool<icu_79::units::UnitsConverter, 8>::MemoryPool() Unexecuted instantiation: icu_79::MemoryPool<icu_79::MeasureUnitImplWithIndex, 8>::MemoryPool() Unexecuted instantiation: icu_79::MemoryPool<icu_79::Measure, 8>::MemoryPool() Unexecuted instantiation: units_converter.cpp:icu_79::MemoryPool<icu_79::units::(anonymous namespace)::UnitIndexAndDimension, 8>::MemoryPool() icu_79::MemoryPool<icu_79::MeasureUnit, 8>::MemoryPool() Line | Count | Source | 756 | 100 | MemoryPool() : fCount(0), fPool() {} |
icu_79::MemoryPool<icu_79::units::ConverterPreference, 8>::MemoryPool() Line | Count | Source | 756 | 100 | MemoryPool() : fCount(0), fPool() {} |
|
757 | | |
758 | 453k | ~MemoryPool() { |
759 | 132M | for (int32_t i = 0; i < fCount; ++i) { |
760 | 131M | delete fPool[i]; |
761 | 131M | } |
762 | 453k | } icu_79::MemoryPool<icu_79::UnicodeString, 8>::~MemoryPool() Line | Count | Source | 758 | 24 | ~MemoryPool() { | 759 | 66.4k | for (int32_t i = 0; i < fCount; ++i) { | 760 | 66.4k | delete fPool[i]; | 761 | 66.4k | } | 762 | 24 | } |
Unexecuted instantiation: icu_79::MemoryPool<LocExtKeyData, 8>::~MemoryPool() Unexecuted instantiation: icu_79::MemoryPool<LocExtType, 8>::~MemoryPool() Unexecuted instantiation: icu_79::MemoryPool<TypeAlias, 8>::~MemoryPool() Unexecuted instantiation: icu_79::MemoryPool<icu_79::FixedString, 8>::~MemoryPool() icu_79::MemoryPool<icu_79::CharString, 8>::~MemoryPool() Line | Count | Source | 758 | 110k | ~MemoryPool() { | 759 | 34.3M | for (int32_t i = 0; i < fCount; ++i) { | 760 | 34.2M | delete fPool[i]; | 761 | 34.2M | } | 762 | 110k | } |
uloc_tag.cpp:icu_79::MemoryPool<(anonymous namespace)::ExtensionListEntry, 8>::~MemoryPool() Line | Count | Source | 758 | 60.4k | ~MemoryPool() { | 759 | 18.4M | for (int32_t i = 0; i < fCount; ++i) { | 760 | 18.3M | delete fPool[i]; | 761 | 18.3M | } | 762 | 60.4k | } |
uloc_tag.cpp:icu_79::MemoryPool<(anonymous namespace)::AttributeListEntry, 8>::~MemoryPool() Line | Count | Source | 758 | 50.9k | ~MemoryPool() { | 759 | 16.0M | for (int32_t i = 0; i < fCount; ++i) { | 760 | 15.9M | delete fPool[i]; | 761 | 15.9M | } | 762 | 50.9k | } |
icu_79::MemoryPool<icu_79::Hashtable, 8>::~MemoryPool() Line | Count | Source | 758 | 11.0k | ~MemoryPool() { | 759 | 73.8k | for (int32_t i = 0; i < fCount; ++i) { | 760 | 62.8k | delete fPool[i]; | 761 | 62.8k | } | 762 | 11.0k | } |
icu_79::MemoryPool<icu_79::SingleUnitImpl, 8>::~MemoryPool() Line | Count | Source | 758 | 12.1k | ~MemoryPool() { | 759 | 12.6k | for (int32_t i = 0; i < fCount; ++i) { | 760 | 500 | delete fPool[i]; | 761 | 500 | } | 762 | 12.1k | } |
Unexecuted instantiation: icu_79::MemoryPool<icu_79::number::impl::MixedUnitLongNameHandler, 8>::~MemoryPool() Unexecuted instantiation: icu_79::MemoryPool<icu_79::number::impl::LongNameHandler, 8>::~MemoryPool() icu_79::MemoryPool<icu_79::units::ConversionRateInfo, 8>::~MemoryPool() Line | Count | Source | 758 | 100 | ~MemoryPool() { | 759 | 15.6k | for (int32_t i = 0; i < fCount; ++i) { | 760 | 15.5k | delete fPool[i]; | 761 | 15.5k | } | 762 | 100 | } |
Unexecuted instantiation: icu_79::MemoryPool<icu_79::Measure, 8>::~MemoryPool() icu_79::MemoryPool<icu_79::units::ConverterPreference, 8>::~MemoryPool() Line | Count | Source | 758 | 100 | ~MemoryPool() { | 759 | 100 | for (int32_t i = 0; i < fCount; ++i) { | 760 | 0 | delete fPool[i]; | 761 | 0 | } | 762 | 100 | } |
Unexecuted instantiation: icu_79::MemoryPool<icu_79::MeasureUnitImplWithIndex, 8>::~MemoryPool() Unexecuted instantiation: icu_79::MemoryPool<icu_79::units::UnitsConverter, 8>::~MemoryPool() icu_79::MemoryPool<icu_79::MeasureUnit, 8>::~MemoryPool() Line | Count | Source | 758 | 100 | ~MemoryPool() { | 759 | 100 | for (int32_t i = 0; i < fCount; ++i) { | 760 | 0 | delete fPool[i]; | 761 | 0 | } | 762 | 100 | } |
icu_79::MemoryPool<icu_79::numparse::impl::CodePointMatcher, 8>::~MemoryPool() Line | Count | Source | 758 | 208k | ~MemoryPool() { | 759 | 63.3M | for (int32_t i = 0; i < fCount; ++i) { | 760 | 63.1M | delete fPool[i]; | 761 | 63.1M | } | 762 | 208k | } |
icu_79::MemoryPool<icu_79::units::UnitPreference, 8>::~MemoryPool() Line | Count | Source | 758 | 200 | ~MemoryPool() { | 759 | 28.8k | for (int32_t i = 0; i < fCount; ++i) { | 760 | 28.6k | delete fPool[i]; | 761 | 28.6k | } | 762 | 200 | } |
icu_79::MemoryPool<icu_79::units::UnitPreferenceMetadata, 8>::~MemoryPool() Line | Count | Source | 758 | 100 | ~MemoryPool() { | 759 | 21.5k | for (int32_t i = 0; i < fCount; ++i) { | 760 | 21.4k | delete fPool[i]; | 761 | 21.4k | } | 762 | 100 | } |
Unexecuted instantiation: units_converter.cpp:icu_79::MemoryPool<icu_79::units::(anonymous namespace)::UnitIndexAndDimension, 8>::~MemoryPool() |
763 | | |
764 | | MemoryPool(const MemoryPool&) = delete; |
765 | | MemoryPool& operator=(const MemoryPool&) = delete; |
766 | | |
767 | 100 | MemoryPool(MemoryPool&& other) noexcept : fCount(other.fCount), |
768 | 100 | fPool(std::move(other.fPool)) { |
769 | 100 | other.fCount = 0; |
770 | 100 | } icu_79::MemoryPool<icu_79::SingleUnitImpl, 8>::MemoryPool(icu_79::MemoryPool<icu_79::SingleUnitImpl, 8>&&) Line | Count | Source | 767 | 100 | MemoryPool(MemoryPool&& other) noexcept : fCount(other.fCount), | 768 | 100 | fPool(std::move(other.fPool)) { | 769 | 100 | other.fCount = 0; | 770 | 100 | } |
Unexecuted instantiation: icu_79::MemoryPool<icu_79::Measure, 8>::MemoryPool(icu_79::MemoryPool<icu_79::Measure, 8>&&) |
771 | | |
772 | 104k | MemoryPool& operator=(MemoryPool&& other) noexcept { |
773 | | // Since `this` may contain instances that need to be deleted, we can't |
774 | | // just throw them away and replace them with `other`. The normal way of |
775 | | // dealing with this in C++ is to swap `this` and `other`, rather than |
776 | | // simply overwrite: the destruction of `other` can then take care of |
777 | | // running MemoryPool::~MemoryPool() over the still-to-be-deallocated |
778 | | // instances. |
779 | 104k | std::swap(fCount, other.fCount); |
780 | 104k | std::swap(fPool, other.fPool); |
781 | 104k | return *this; |
782 | 104k | } icu_79::MemoryPool<icu_79::numparse::impl::CodePointMatcher, 8>::operator=(icu_79::MemoryPool<icu_79::numparse::impl::CodePointMatcher, 8>&&) Line | Count | Source | 772 | 104k | MemoryPool& operator=(MemoryPool&& other) noexcept { | 773 | | // Since `this` may contain instances that need to be deleted, we can't | 774 | | // just throw them away and replace them with `other`. The normal way of | 775 | | // dealing with this in C++ is to swap `this` and `other`, rather than | 776 | | // simply overwrite: the destruction of `other` can then take care of | 777 | | // running MemoryPool::~MemoryPool() over the still-to-be-deallocated | 778 | | // instances. | 779 | 104k | std::swap(fCount, other.fCount); | 780 | 104k | std::swap(fPool, other.fPool); | 781 | 104k | return *this; | 782 | 104k | } |
Unexecuted instantiation: icu_79::MemoryPool<icu_79::MeasureUnitImplWithIndex, 8>::operator=(icu_79::MemoryPool<icu_79::MeasureUnitImplWithIndex, 8>&&) Unexecuted instantiation: icu_79::MemoryPool<icu_79::SingleUnitImpl, 8>::operator=(icu_79::MemoryPool<icu_79::SingleUnitImpl, 8>&&) |
783 | | |
784 | | /** |
785 | | * Creates a new object of typename T, by forwarding any and all arguments |
786 | | * to the typename T constructor. |
787 | | * |
788 | | * @param args Arguments to be forwarded to the typename T constructor. |
789 | | * @return A pointer to the newly created object, or nullptr on error. |
790 | | */ |
791 | | template<typename... Args> |
792 | 131M | T* create(Args&&... args) { |
793 | 131M | int32_t capacity = fPool.getCapacity(); |
794 | 131M | if (fCount == capacity && |
795 | 69.7k | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, |
796 | 69.7k | capacity) == nullptr) { |
797 | 0 | return nullptr; |
798 | 0 | } |
799 | 131M | return fPool[fCount++] = new T(std::forward<Args>(args)...); |
800 | 131M | } icu_79::UnicodeString* icu_79::MemoryPool<icu_79::UnicodeString, 8>::create<icu_79::UnicodeString&>(icu_79::UnicodeString&) Line | Count | Source | 792 | 66.4k | T* create(Args&&... args) { | 793 | 66.4k | int32_t capacity = fPool.getCapacity(); | 794 | 66.4k | if (fCount == capacity && | 795 | 81 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 81 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 66.4k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 66.4k | } |
icu_79::FixedString* icu_79::MemoryPool<icu_79::FixedString, 8>::create<>() Line | Count | Source | 792 | 7.01k | T* create(Args&&... args) { | 793 | 7.01k | int32_t capacity = fPool.getCapacity(); | 794 | 7.01k | if (fCount == capacity && | 795 | 70 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 70 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 7.01k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 7.01k | } |
icu_79::FixedString* icu_79::MemoryPool<icu_79::FixedString, 8>::create<std::__1::basic_string_view<char, std::__1::char_traits<char> >&>(std::__1::basic_string_view<char, std::__1::char_traits<char> >&) Line | Count | Source | 792 | 7.78k | T* create(Args&&... args) { | 793 | 7.78k | int32_t capacity = fPool.getCapacity(); | 794 | 7.78k | if (fCount == capacity && | 795 | 28 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 28 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 7.78k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 7.78k | } |
LocExtType* icu_79::MemoryPool<LocExtType, 8>::create<>() Line | Count | Source | 792 | 14.7k | T* create(Args&&... args) { | 793 | 14.7k | int32_t capacity = fPool.getCapacity(); | 794 | 14.7k | if (fCount == capacity && | 795 | 98 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 98 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 14.7k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 14.7k | } |
TypeAlias* icu_79::MemoryPool<TypeAlias, 8>::create<TypeAlias>(TypeAlias&&) Line | Count | Source | 792 | 2.49k | T* create(Args&&... args) { | 793 | 2.49k | int32_t capacity = fPool.getCapacity(); | 794 | 2.49k | if (fCount == capacity && | 795 | 56 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 56 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 2.49k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 2.49k | } |
LocExtKeyData* icu_79::MemoryPool<LocExtKeyData, 8>::create<>() Line | Count | Source | 792 | 518 | T* create(Args&&... args) { | 793 | 518 | int32_t capacity = fPool.getCapacity(); | 794 | 518 | if (fCount == capacity && | 795 | 28 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 28 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 518 | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 518 | } |
uloc_tag.cpp:(anonymous namespace)::AttributeListEntry* icu_79::MemoryPool<(anonymous namespace)::AttributeListEntry, 8>::create<>() Line | Count | Source | 792 | 15.9M | T* create(Args&&... args) { | 793 | 15.9M | int32_t capacity = fPool.getCapacity(); | 794 | 15.9M | if (fCount == capacity && | 795 | 6.88k | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 6.88k | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 15.9M | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 15.9M | } |
icu_79::CharString* icu_79::MemoryPool<icu_79::CharString, 8>::create<icu_79::CharString, UErrorCode&>(icu_79::CharString&&, UErrorCode&) Line | Count | Source | 792 | 4.89M | T* create(Args&&... args) { | 793 | 4.89M | int32_t capacity = fPool.getCapacity(); | 794 | 4.89M | if (fCount == capacity && | 795 | 618 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 618 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 4.89M | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 4.89M | } |
icu_79::CharString* icu_79::MemoryPool<icu_79::CharString, 8>::create<icu_79::CharString&, UErrorCode&>(icu_79::CharString&, UErrorCode&) Line | Count | Source | 792 | 2.77k | T* create(Args&&... args) { | 793 | 2.77k | int32_t capacity = fPool.getCapacity(); | 794 | 2.77k | if (fCount == capacity && | 795 | 131 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 131 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 2.77k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 2.77k | } |
icu_79::CharString* icu_79::MemoryPool<icu_79::CharString, 8>::create<char*, int&, UErrorCode&>(char*&&, int&, UErrorCode&) Line | Count | Source | 792 | 900 | T* create(Args&&... args) { | 793 | 900 | int32_t capacity = fPool.getCapacity(); | 794 | 900 | if (fCount == capacity && | 795 | 18 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 18 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 900 | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 900 | } |
uloc_tag.cpp:(anonymous namespace)::ExtensionListEntry* icu_79::MemoryPool<(anonymous namespace)::ExtensionListEntry, 8>::create<>() Line | Count | Source | 792 | 18.3M | T* create(Args&&... args) { | 793 | 18.3M | int32_t capacity = fPool.getCapacity(); | 794 | 18.3M | if (fCount == capacity && | 795 | 19.3k | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 19.3k | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 18.3M | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 18.3M | } |
icu_79::CharString* icu_79::MemoryPool<icu_79::CharString, 8>::create<char const*&, int&, UErrorCode&>(char const*&, int&, UErrorCode&) Line | Count | Source | 792 | 29.2M | T* create(Args&&... args) { | 793 | 29.2M | int32_t capacity = fPool.getCapacity(); | 794 | 29.2M | if (fCount == capacity && | 795 | 21.4k | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 21.4k | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 29.2M | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 29.2M | } |
icu_79::CharString* icu_79::MemoryPool<icu_79::CharString, 8>::create<>() Line | Count | Source | 792 | 13.2k | T* create(Args&&... args) { | 793 | 13.2k | int32_t capacity = fPool.getCapacity(); | 794 | 13.2k | if (fCount == capacity && | 795 | 2 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 2 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 13.2k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 13.2k | } |
icu_79::Hashtable* icu_79::MemoryPool<icu_79::Hashtable, 8>::create<bool, UErrorCode&>(bool&&, UErrorCode&) Line | Count | Source | 792 | 62.8k | T* create(Args&&... args) { | 793 | 62.8k | int32_t capacity = fPool.getCapacity(); | 794 | 62.8k | if (fCount == capacity && | 795 | 4.55k | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 4.55k | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 62.8k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 62.8k | } |
icu_79::SingleUnitImpl* icu_79::MemoryPool<icu_79::SingleUnitImpl, 8>::create<icu_79::SingleUnitImpl const&>(icu_79::SingleUnitImpl const&) Line | Count | Source | 792 | 500 | T* create(Args&&... args) { | 793 | 500 | int32_t capacity = fPool.getCapacity(); | 794 | 500 | if (fCount == capacity && | 795 | 0 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 0 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 500 | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 500 | } |
Unexecuted instantiation: icu_79::number::impl::MixedUnitLongNameHandler* icu_79::MemoryPool<icu_79::number::impl::MixedUnitLongNameHandler, 8>::create<>() Unexecuted instantiation: icu_79::number::impl::LongNameHandler* icu_79::MemoryPool<icu_79::number::impl::LongNameHandler, 8>::create<>() icu_79::units::ConversionRateInfo* icu_79::MemoryPool<icu_79::units::ConversionRateInfo, 8>::create<>() Line | Count | Source | 792 | 15.5k | T* create(Args&&... args) { | 793 | 15.5k | int32_t capacity = fPool.getCapacity(); | 794 | 15.5k | if (fCount == capacity && | 795 | 400 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 400 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 15.5k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 15.5k | } |
icu_79::units::UnitPreferenceMetadata* icu_79::MemoryPool<icu_79::units::UnitPreferenceMetadata, 8>::create<char const*&, char const*&, char const*&, int&, int&, UErrorCode&>(char const*&, char const*&, char const*&, int&, int&, UErrorCode&) Line | Count | Source | 792 | 21.4k | T* create(Args&&... args) { | 793 | 21.4k | int32_t capacity = fPool.getCapacity(); | 794 | 21.4k | if (fCount == capacity && | 795 | 400 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 400 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 21.4k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 21.4k | } |
icu_79::units::UnitPreference* icu_79::MemoryPool<icu_79::units::UnitPreference, 8>::create<>() Line | Count | Source | 792 | 28.6k | T* create(Args&&... args) { | 793 | 28.6k | int32_t capacity = fPool.getCapacity(); | 794 | 28.6k | if (fCount == capacity && | 795 | 500 | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 500 | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 28.6k | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 28.6k | } |
Unexecuted instantiation: icu_79::units::UnitPreference* icu_79::MemoryPool<icu_79::units::UnitPreference, 8>::create<icu_79::units::UnitPreference&>(icu_79::units::UnitPreference&) Unexecuted instantiation: icu_79::units::UnitPreference* icu_79::MemoryPool<icu_79::units::UnitPreference, 8>::create<icu_79::units::UnitPreference const&>(icu_79::units::UnitPreference const&) Unexecuted instantiation: icu_79::units::UnitsConverter* icu_79::MemoryPool<icu_79::units::UnitsConverter, 8>::create<icu_79::MeasureUnitImpl const&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&>(icu_79::MeasureUnitImpl const&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&) Unexecuted instantiation: icu_79::units::UnitsConverter* icu_79::MemoryPool<icu_79::units::UnitsConverter, 8>::create<icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&>(icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&) Unexecuted instantiation: icu_79::Measure* icu_79::MemoryPool<icu_79::Measure, 8>::create<icu_79::Measure&>(icu_79::Measure&) Unexecuted instantiation: units_converter.cpp:icu_79::units::(anonymous namespace)::UnitIndexAndDimension* icu_79::MemoryPool<icu_79::units::(anonymous namespace)::UnitIndexAndDimension, 8>::create<icu_79::SingleUnitImpl const&, int&>(icu_79::SingleUnitImpl const&, int&) Unexecuted instantiation: icu_79::MeasureUnit* icu_79::MemoryPool<icu_79::MeasureUnit, 8>::create<icu_79::MeasureUnit&>(icu_79::MeasureUnit&) Unexecuted instantiation: icu_79::units::ConverterPreference* icu_79::MemoryPool<icu_79::units::ConverterPreference, 8>::create<icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, double const&, icu_79::UnicodeString&, icu_79::units::ConversionRates&, UErrorCode&>(icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, double const&, icu_79::UnicodeString&, icu_79::units::ConversionRates&, UErrorCode&) Unexecuted instantiation: icu_79::MeasureUnitImplWithIndex* icu_79::MemoryPool<icu_79::MeasureUnitImplWithIndex, 8>::create<int&, icu_79::MeasureUnitImpl const&, UErrorCode&>(int&, icu_79::MeasureUnitImpl const&, UErrorCode&) Unexecuted instantiation: icu_79::MeasureUnitImplWithIndex* icu_79::MemoryPool<icu_79::MeasureUnitImplWithIndex, 8>::create<int&, icu_79::SingleUnitImpl const&, UErrorCode&>(int&, icu_79::SingleUnitImpl const&, UErrorCode&) icu_79::numparse::impl::CodePointMatcher* icu_79::MemoryPool<icu_79::numparse::impl::CodePointMatcher, 8>::create<int&>(int&) Line | Count | Source | 792 | 63.1M | T* create(Args&&... args) { | 793 | 63.1M | int32_t capacity = fPool.getCapacity(); | 794 | 63.1M | if (fCount == capacity && | 795 | 15.1k | fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 796 | 15.1k | capacity) == nullptr) { | 797 | 0 | return nullptr; | 798 | 0 | } | 799 | 63.1M | return fPool[fCount++] = new T(std::forward<Args>(args)...); | 800 | 63.1M | } |
|
801 | | |
802 | | template <typename... Args> |
803 | 426 | T* createAndCheckErrorCode(UErrorCode &status, Args &&... args) { |
804 | 426 | if (U_FAILURE(status)) { |
805 | 0 | return nullptr; |
806 | 0 | } |
807 | 426 | T *pointer = this->create(args...); |
808 | 426 | if (U_SUCCESS(status) && pointer == nullptr) { |
809 | 0 | status = U_MEMORY_ALLOCATION_ERROR; |
810 | 0 | } |
811 | 426 | return pointer; |
812 | 426 | } Unexecuted instantiation: icu_79::number::impl::MixedUnitLongNameHandler* icu_79::MemoryPool<icu_79::number::impl::MixedUnitLongNameHandler, 8>::createAndCheckErrorCode<>(UErrorCode&) Unexecuted instantiation: icu_79::number::impl::LongNameHandler* icu_79::MemoryPool<icu_79::number::impl::LongNameHandler, 8>::createAndCheckErrorCode<>(UErrorCode&) Unexecuted instantiation: icu_79::units::UnitPreference* icu_79::MemoryPool<icu_79::units::UnitPreference, 8>::createAndCheckErrorCode<icu_79::units::UnitPreference&>(UErrorCode&, icu_79::units::UnitPreference&) Unexecuted instantiation: icu_79::units::UnitPreference* icu_79::MemoryPool<icu_79::units::UnitPreference, 8>::createAndCheckErrorCode<icu_79::units::UnitPreference const&>(UErrorCode&, icu_79::units::UnitPreference const&) Unexecuted instantiation: icu_79::units::UnitsConverter* icu_79::MemoryPool<icu_79::units::UnitsConverter, 8>::createAndCheckErrorCode<icu_79::MeasureUnitImpl const&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&>(UErrorCode&, icu_79::MeasureUnitImpl const&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&) Unexecuted instantiation: icu_79::units::UnitsConverter* icu_79::MemoryPool<icu_79::units::UnitsConverter, 8>::createAndCheckErrorCode<icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&>(UErrorCode&, icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&) Unexecuted instantiation: icu_79::Measure* icu_79::MemoryPool<icu_79::Measure, 8>::createAndCheckErrorCode<icu_79::Measure&>(UErrorCode&, icu_79::Measure&) Unexecuted instantiation: icu_79::MeasureUnit* icu_79::MemoryPool<icu_79::MeasureUnit, 8>::createAndCheckErrorCode<icu_79::MeasureUnit&>(UErrorCode&, icu_79::MeasureUnit&) Unexecuted instantiation: icu_79::units::ConverterPreference* icu_79::MemoryPool<icu_79::units::ConverterPreference, 8>::createAndCheckErrorCode<icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, double const&, icu_79::UnicodeString&, icu_79::units::ConversionRates&, UErrorCode&>(UErrorCode&, icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, double const&, icu_79::UnicodeString&, icu_79::units::ConversionRates&, UErrorCode&) icu_79::CharString* icu_79::MemoryPool<icu_79::CharString, 8>::createAndCheckErrorCode<>(UErrorCode&) Line | Count | Source | 803 | 26 | T* createAndCheckErrorCode(UErrorCode &status, Args &&... args) { | 804 | 26 | if (U_FAILURE(status)) { | 805 | 0 | return nullptr; | 806 | 0 | } | 807 | 26 | T *pointer = this->create(args...); | 808 | 26 | if (U_SUCCESS(status) && pointer == nullptr) { | 809 | 0 | status = U_MEMORY_ALLOCATION_ERROR; | 810 | 0 | } | 811 | 26 | return pointer; | 812 | 26 | } |
icu_79::SingleUnitImpl* icu_79::MemoryPool<icu_79::SingleUnitImpl, 8>::createAndCheckErrorCode<icu_79::SingleUnitImpl const&>(UErrorCode&, icu_79::SingleUnitImpl const&) Line | Count | Source | 803 | 400 | T* createAndCheckErrorCode(UErrorCode &status, Args &&... args) { | 804 | 400 | if (U_FAILURE(status)) { | 805 | 0 | return nullptr; | 806 | 0 | } | 807 | 400 | T *pointer = this->create(args...); | 808 | 400 | if (U_SUCCESS(status) && pointer == nullptr) { | 809 | 0 | status = U_MEMORY_ALLOCATION_ERROR; | 810 | 0 | } | 811 | 400 | return pointer; | 812 | 400 | } |
Unexecuted instantiation: icu_79::MeasureUnitImplWithIndex* icu_79::MemoryPool<icu_79::MeasureUnitImplWithIndex, 8>::createAndCheckErrorCode<int&, icu_79::MeasureUnitImpl const&, UErrorCode&>(UErrorCode&, int&, icu_79::MeasureUnitImpl const&, UErrorCode&) Unexecuted instantiation: icu_79::MeasureUnitImplWithIndex* icu_79::MemoryPool<icu_79::MeasureUnitImplWithIndex, 8>::createAndCheckErrorCode<int&, icu_79::SingleUnitImpl const&, UErrorCode&>(UErrorCode&, int&, icu_79::SingleUnitImpl const&, UErrorCode&) |
813 | | |
814 | | /** |
815 | | * @return Number of elements that have been allocated. |
816 | | */ |
817 | | int32_t count() const { |
818 | | return fCount; |
819 | | } |
820 | | |
821 | | protected: |
822 | | int32_t fCount; |
823 | | MaybeStackArray<T*, stackCapacity> fPool; |
824 | | }; |
825 | | |
826 | | /** |
827 | | * An internal Vector-like implementation based on MemoryPool. |
828 | | * |
829 | | * Heap-allocates each element and stores pointers. |
830 | | * |
831 | | * To append an item to the vector, use emplaceBack. |
832 | | * |
833 | | * MaybeStackVector<MyType> vector; |
834 | | * MyType* element = vector.emplaceBack(); |
835 | | * if (!element) { |
836 | | * status = U_MEMORY_ALLOCATION_ERROR; |
837 | | * } |
838 | | * // do stuff with element |
839 | | * |
840 | | * To loop over the vector, use a for loop with indices: |
841 | | * |
842 | | * for (int32_t i = 0; i < vector.length(); i++) { |
843 | | * MyType* element = vector[i]; |
844 | | * } |
845 | | */ |
846 | | template<typename T, int32_t stackCapacity = 8> |
847 | | class MaybeStackVector : protected MemoryPool<T, stackCapacity> { |
848 | | public: |
849 | | template<typename... Args> |
850 | 65.6k | T* emplaceBack(Args&&... args) { |
851 | 65.6k | return this->create(args...); |
852 | 65.6k | } icu_79::SingleUnitImpl* icu_79::MaybeStackVector<icu_79::SingleUnitImpl, 8>::emplaceBack<icu_79::SingleUnitImpl const&>(icu_79::SingleUnitImpl const&) Line | Count | Source | 850 | 100 | T* emplaceBack(Args&&... args) { | 851 | 100 | return this->create(args...); | 852 | 100 | } |
icu_79::units::ConversionRateInfo* icu_79::MaybeStackVector<icu_79::units::ConversionRateInfo, 8>::emplaceBack<>() Line | Count | Source | 850 | 15.5k | T* emplaceBack(Args&&... args) { | 851 | 15.5k | return this->create(args...); | 852 | 15.5k | } |
icu_79::units::UnitPreferenceMetadata* icu_79::MaybeStackVector<icu_79::units::UnitPreferenceMetadata, 8>::emplaceBack<char const*&, char const*&, char const*&, int, int&, UErrorCode&>(char const*&, char const*&, char const*&, int&&, int&, UErrorCode&) Line | Count | Source | 850 | 21.4k | T* emplaceBack(Args&&... args) { | 851 | 21.4k | return this->create(args...); | 852 | 21.4k | } |
icu_79::units::UnitPreference* icu_79::MaybeStackVector<icu_79::units::UnitPreference, 8>::emplaceBack<>() Line | Count | Source | 850 | 28.6k | T* emplaceBack(Args&&... args) { | 851 | 28.6k | return this->create(args...); | 852 | 28.6k | } |
Unexecuted instantiation: units_converter.cpp:icu_79::units::(anonymous namespace)::UnitIndexAndDimension* icu_79::MaybeStackVector<icu_79::units::(anonymous namespace)::UnitIndexAndDimension, 8>::emplaceBack<icu_79::SingleUnitImpl const&, int&>(icu_79::SingleUnitImpl const&, int&) |
853 | | |
854 | | template <typename... Args> |
855 | 426 | T *emplaceBackAndCheckErrorCode(UErrorCode &status, Args &&... args) { |
856 | 426 | return this->createAndCheckErrorCode(status, args...); |
857 | 426 | } Unexecuted instantiation: icu_79::units::UnitPreference* icu_79::MaybeStackVector<icu_79::units::UnitPreference, 8>::emplaceBackAndCheckErrorCode<icu_79::units::UnitPreference&>(UErrorCode&, icu_79::units::UnitPreference&) Unexecuted instantiation: icu_79::units::UnitPreference* icu_79::MaybeStackVector<icu_79::units::UnitPreference, 8>::emplaceBackAndCheckErrorCode<icu_79::units::UnitPreference const&>(UErrorCode&, icu_79::units::UnitPreference const&) Unexecuted instantiation: icu_79::units::UnitsConverter* icu_79::MaybeStackVector<icu_79::units::UnitsConverter, 8>::emplaceBackAndCheckErrorCode<icu_79::MeasureUnitImpl const&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&>(UErrorCode&, icu_79::MeasureUnitImpl const&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&) Unexecuted instantiation: icu_79::units::UnitsConverter* icu_79::MaybeStackVector<icu_79::units::UnitsConverter, 8>::emplaceBackAndCheckErrorCode<icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&>(UErrorCode&, icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, icu_79::units::ConversionRates const&, UErrorCode&) Unexecuted instantiation: icu_79::Measure* icu_79::MaybeStackVector<icu_79::Measure, 8>::emplaceBackAndCheckErrorCode<icu_79::Measure&>(UErrorCode&, icu_79::Measure&) Unexecuted instantiation: icu_79::MeasureUnit* icu_79::MaybeStackVector<icu_79::MeasureUnit, 8>::emplaceBackAndCheckErrorCode<icu_79::MeasureUnit>(UErrorCode&, icu_79::MeasureUnit&&) Unexecuted instantiation: icu_79::units::ConverterPreference* icu_79::MaybeStackVector<icu_79::units::ConverterPreference, 8>::emplaceBackAndCheckErrorCode<icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, double const&, icu_79::UnicodeString, icu_79::units::ConversionRates&, UErrorCode&>(UErrorCode&, icu_79::MeasureUnitImpl&, icu_79::MeasureUnitImpl&, double const&, icu_79::UnicodeString&&, icu_79::units::ConversionRates&, UErrorCode&) icu_79::CharString* icu_79::MaybeStackVector<icu_79::CharString, 8>::emplaceBackAndCheckErrorCode<>(UErrorCode&) Line | Count | Source | 855 | 26 | T *emplaceBackAndCheckErrorCode(UErrorCode &status, Args &&... args) { | 856 | 26 | return this->createAndCheckErrorCode(status, args...); | 857 | 26 | } |
icu_79::SingleUnitImpl* icu_79::MaybeStackVector<icu_79::SingleUnitImpl, 8>::emplaceBackAndCheckErrorCode<icu_79::SingleUnitImpl const&>(UErrorCode&, icu_79::SingleUnitImpl const&) Line | Count | Source | 855 | 400 | T *emplaceBackAndCheckErrorCode(UErrorCode &status, Args &&... args) { | 856 | 400 | return this->createAndCheckErrorCode(status, args...); | 857 | 400 | } |
Unexecuted instantiation: icu_79::MeasureUnitImplWithIndex* icu_79::MaybeStackVector<icu_79::MeasureUnitImplWithIndex, 8>::emplaceBackAndCheckErrorCode<int, icu_79::MeasureUnitImpl const&, UErrorCode&>(UErrorCode&, int&&, icu_79::MeasureUnitImpl const&, UErrorCode&) Unexecuted instantiation: icu_79::MeasureUnitImplWithIndex* icu_79::MaybeStackVector<icu_79::MeasureUnitImplWithIndex, 8>::emplaceBackAndCheckErrorCode<int&, icu_79::SingleUnitImpl const&, UErrorCode&>(UErrorCode&, int&, icu_79::SingleUnitImpl const&, UErrorCode&) |
858 | | |
859 | 96.6k | int32_t length() const { |
860 | 96.6k | return this->fCount; |
861 | 96.6k | } icu_79::MaybeStackVector<icu_79::SingleUnitImpl, 8>::length() const Line | Count | Source | 859 | 10.9k | int32_t length() const { | 860 | 10.9k | return this->fCount; | 861 | 10.9k | } |
Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::MeasureUnit, 8>::length() const Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::Measure, 8>::length() const icu_79::MaybeStackVector<icu_79::units::UnitPreference, 8>::length() const Line | Count | Source | 859 | 21.5k | int32_t length() const { | 860 | 21.5k | return this->fCount; | 861 | 21.5k | } |
icu_79::MaybeStackVector<icu_79::units::UnitPreferenceMetadata, 8>::length() const Line | Count | Source | 859 | 64.1k | int32_t length() const { | 860 | 64.1k | return this->fCount; | 861 | 64.1k | } |
icu_79::MaybeStackVector<icu_79::units::ConversionRateInfo, 8>::length() const Line | Count | Source | 859 | 100 | int32_t length() const { | 860 | 100 | return this->fCount; | 861 | 100 | } |
Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::MeasureUnitImplWithIndex, 8>::length() const Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::units::UnitsConverter, 8>::length() const Unexecuted instantiation: units_converter.cpp:icu_79::MaybeStackVector<icu_79::units::(anonymous namespace)::UnitIndexAndDimension, 8>::length() const Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::units::ConverterPreference, 8>::length() const icu_79::MaybeStackVector<icu_79::CharString, 8>::length() const Line | Count | Source | 859 | 44 | int32_t length() const { | 860 | 44 | return this->fCount; | 861 | 44 | } |
|
862 | | |
863 | 0 | T** getAlias() { |
864 | 0 | return this->fPool.getAlias(); |
865 | 0 | } Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::MeasureUnitImplWithIndex, 8>::getAlias() Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::SingleUnitImpl, 8>::getAlias() |
866 | | |
867 | | const T *const *getAlias() const { |
868 | | return this->fPool.getAlias(); |
869 | | } |
870 | | |
871 | | /** |
872 | | * Array item access (read-only). |
873 | | * No index bounds check. |
874 | | * @param i array index |
875 | | * @return reference to the array item |
876 | | */ |
877 | 11.7k | const T* operator[](ptrdiff_t i) const { |
878 | 11.7k | return this->fPool[i]; |
879 | 11.7k | } icu_79::MaybeStackVector<icu_79::SingleUnitImpl, 8>::operator[](long) const Line | Count | Source | 877 | 300 | const T* operator[](ptrdiff_t i) const { | 878 | 300 | return this->fPool[i]; | 879 | 300 | } |
Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::MeasureUnit, 8>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::Measure, 8>::operator[](long) const icu_79::MaybeStackVector<icu_79::units::UnitPreferenceMetadata, 8>::operator[](long) const Line | Count | Source | 877 | 700 | const T* operator[](ptrdiff_t i) const { | 878 | 700 | return this->fPool[i]; | 879 | 700 | } |
icu_79::MaybeStackVector<icu_79::units::ConversionRateInfo, 8>::operator[](long) const Line | Count | Source | 877 | 10.7k | const T* operator[](ptrdiff_t i) const { | 878 | 10.7k | return this->fPool[i]; | 879 | 10.7k | } |
Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::units::UnitPreference, 8>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::units::UnitsConverter, 8>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::MeasureUnitImplWithIndex, 8>::operator[](long) const Unexecuted instantiation: units_converter.cpp:icu_79::MaybeStackVector<icu_79::units::(anonymous namespace)::UnitIndexAndDimension, 8>::operator[](long) const Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::units::ConverterPreference, 8>::operator[](long) const |
880 | | |
881 | | /** |
882 | | * Array item access (writable). |
883 | | * No index bounds check. |
884 | | * @param i array index |
885 | | * @return reference to the array item |
886 | | */ |
887 | 43.1k | T* operator[](ptrdiff_t i) { |
888 | 43.1k | return this->fPool[i]; |
889 | 43.1k | } icu_79::MaybeStackVector<icu_79::SingleUnitImpl, 8>::operator[](long) Line | Count | Source | 887 | 500 | T* operator[](ptrdiff_t i) { | 888 | 500 | return this->fPool[i]; | 889 | 500 | } |
icu_79::MaybeStackVector<icu_79::units::UnitPreferenceMetadata, 8>::operator[](long) Line | Count | Source | 887 | 42.6k | T* operator[](ptrdiff_t i) { | 888 | 42.6k | return this->fPool[i]; | 889 | 42.6k | } |
Unexecuted instantiation: icu_79::MaybeStackVector<icu_79::MeasureUnitImplWithIndex, 8>::operator[](long) Unexecuted instantiation: units_converter.cpp:icu_79::MaybeStackVector<icu_79::units::(anonymous namespace)::UnitIndexAndDimension, 8>::operator[](long) icu_79::MaybeStackVector<icu_79::CharString, 8>::operator[](long) Line | Count | Source | 887 | 52 | T* operator[](ptrdiff_t i) { | 888 | 52 | return this->fPool[i]; | 889 | 52 | } |
|
890 | | }; |
891 | | |
892 | | |
893 | | U_NAMESPACE_END |
894 | | |
895 | | #endif /* __cplusplus */ |
896 | | #endif /* CMEMORY_H */ |