StrTryInitFromCstr
Description
Initialise *out as a Str holding len bytes copied from cstr, allocated through allocator_ptr (accepts a typed allocator handle or a raw Allocator *).
Success
Returns true. *out is a usable Str holding the copied bytes; trailing NUL written at out->data[len].
Failure
Returns false on allocator OOM. *out is left as an empty Str bound to the allocator. LOG_FATAL if out or cstr is NULL.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
PdbCache.c:103:
MemSet(&entry, 0, sizeof(entry));
if (!StrTryInitFromCstr(&entry.module_path, module_path, ZstrLen(module_path), self->allocator)) {
return NULL;
}- In
MachoCache.c:49:
MemSet(&entry, 0, sizeof(entry));
if (!StrTryInitFromCstr(&entry.module_path, module_path, ZstrLen(module_path), self->allocator)) {
return NULL;
} PdbCacheEntry entry;
MemSet(&entry, 0, sizeof(entry));
bool inited = StrTryInitFromCstr(&entry.module_path, pe_path, ZstrLen(pe_path), base);
if (inited) {
size before = DebugAllocatorLiveCount(&dbg); PdbCacheEntry entry;
MemSet(&entry, 0, sizeof(entry));
bool inited = StrTryInitFromCstr(&entry.module_path, pe_path, ZstrLen(pe_path), base);
if (inited) {
bool opened = entry_open(&entry, base);
Last updated on