ZstrDup
Description
Duplicates a string in full.
alloc is optional inside a Scope block (defaults to MisraScope).
Success
Returns a pointer to the newly allocated duplicate string.
Failure
Returns NULL if memory allocation fails or src is NULL.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
VecCharPtr.c:21:
return false;
}
*dst = ZstrDup(*src, (Allocator *)alloc);
return *dst != NULL;
}- In
VecCharPtr.c:179:
char *str = generate_cstring(data, offset, data_size, 16);
if (str) {
VecAt(vec, i) = (char *)ZstrDup(str, (Allocator *)alloc);
cleanup_cstring(str);
}
Last updated on