@param str must be a utf8 encoded string, does not need to be 0-terminated. @param length must be its length in bytes.
| 215 | ///@param str must be a utf8 encoded string, does not need to be 0-terminated. |
| 216 | ///@param length must be its length in bytes. |
| 217 | IndexedString::IndexedString(const char* str, unsigned short length, uint hash) |
| 218 | { |
| 219 | if (!length) { |
| 220 | m_index = 0; |
| 221 | } else if (length == 1) { |
| 222 | m_index = charToIndex(str[0]); |
| 223 | } else { |
| 224 | const auto request = IndexedStringRepositoryItemRequest(str, hash ? hash : hashString(str, length), length); |
| 225 | bool refcount = shouldDoDUChainReferenceCounting(this); |
| 226 | m_index = LockedItemRepository::write<IndexedString>([request, refcount](IndexedStringRepository& repo) { |
| 227 | auto index = repo.index(request); |
| 228 | if (refcount) { |
| 229 | ReferenceCountChanger::increase(index)(repo); |
| 230 | } |
| 231 | return index; |
| 232 | }); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | IndexedString::IndexedString(char c) |
| 237 | : m_index(charToIndex(c)) |
nothing calls this directly
no test coverage detected