MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / intern

Method intern

src/simulate/heap.cpp:239–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237 }
238
239 char * StringHeapAllocator::intern(const char * str, uint64_t length) const {
240 if ( needIntern ) {
241 // Intern caps at 4GB string length — StrHashEntry stores length as uint32.
242 DAS_ASSERTF(length <= UINT32_MAX, "intern requires length < 4GB, got %llu", (unsigned long long)length);
243 auto it = internMap.find(StrHashEntry(str,uint32_t(length)));
244 return it != internMap.end() ? (char *)it->ptr : nullptr;
245 } else {
246 return nullptr;
247 }
248 }
249
250 void StringHeapAllocator::recognize ( char * str ) {
251 if ( !str ) return;

Callers 2

builtin_string_tolowerFunction · 0.45
builtin_string_toupperFunction · 0.45

Calls 3

StrHashEntryClass · 0.85
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected