StrMergeL
StrMergeL
Description
Merge two strings and store the result in first string, with L-value semantics.
Data is copied from str2 into str. If a copy_init method is provided in str, each element from str2 will be copied using that method. Otherwise, a raw memory copy is performed.
This function completely transfers ownership from str2 to str by:
- Adding all elements from
str2tostr - Freeing the memory allocated for
str2->data - Resetting all fields of
str2to zero using MemSet
Parameters
| Name | Direction | Description |
|---|---|---|
str |
in,out | Str to insert array chars into. |
str2 |
in,out | Str to be inserted and reset. |
Success
str
Failure
NULL
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Str.Insert.c:246:
// Test StrMergeL function
bool test_str_merge_l(void) {
WriteFmt("Testing StrMergeL\n");
Str s1 = StrInitFromZstr("Hello");- In
Str.Insert.c:252:
// Merge s2 into s1 (L-value semantics)
StrMergeL(&s1, &s2);
// Validate both vectors
Last updated on