StrInitCopyAlloc
Description
Copy a Str through an explicit destination allocator context.
This is primarily used by generic containers during deep-copy insertion.
Parameters
| Name | Direction | Description |
|---|---|---|
dst |
out | Destination Str. |
src |
in | Source Str. |
alloc |
in | Allocator context for the owning destination container. |
Success
Returns true. *dst is a deep copy of *src with the byte buffer allocated through alloc (not the source’s allocator). Length matches src->length.
Failure
Returns false on allocation failure for the destination buffer. *dst is left in an initialized- but-empty state.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Str.c:108:
}
return StrInitCopyAlloc(dst, src, &src->allocator);
}- In
Str.c:111:
}
bool StrInitCopyAlloc(void *dst_ptr, const void *src_ptr, const Allocator *alloc) {
Str *dst = (Str *)dst_ptr;
const Str *src = (const Str *)src_ptr;- In
KvConfig.h:49:
KvConfigCompare, \
KvConfigCompare, \
StrInitCopyAlloc, \
StrDeinitAlloc, \
StrInitCopyAlloc, \
- In
KvConfig.h:51:
StrInitCopyAlloc, \
StrDeinitAlloc, \
StrInitCopyAlloc, \
StrDeinitAlloc \
)
Last updated on