Skip to content

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)
            return false;
        }
        *dst = ZstrDup(*src, (Allocator *)alloc);
        return *dst != NULL;
    }
                            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