Get the number of elements in a heap array Caller must have a read lock or a write lock on heapLock before calling this!
| 102 | // Get the number of elements in a heap array |
| 103 | // Caller must have a read lock or a write lock on heapLock before calling this! |
| 104 | size_t ArrayHandle::GetNumElements() const noexcept |
| 105 | { |
| 106 | #if CHECK_HEAP_LOCKED |
| 107 | Heap::heapLock.CheckHasReadOrWriteLock(); |
| 108 | #endif |
| 109 | if (slotPtr == nullptr) |
| 110 | { |
| 111 | return 0; |
| 112 | } |
| 113 | #if CHECK_HANDLES |
| 114 | Heap::CheckSlotGood(slotPtr); |
| 115 | #endif |
| 116 | const Heap::StorageSpace *null storage = slotPtr->storage; |
| 117 | if (storage == nullptr) |
| 118 | { |
| 119 | return 0; |
| 120 | } |
| 121 | return reinterpret_cast<const ArrayStorageSpace*>(_ecv_not_null(storage))->count; |
| 122 | } |
| 123 | |
| 124 | // Retrieve an array element, returning false if the index is out of bounds |
| 125 | // Caller must have a read lock on heapLock before calling this! |
no outgoing calls
no test coverage detected