StrMergeL
- Macro
- October 8, 2025
Table of Contents
StrMergeL
StrMergeLDescription
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.
Note
This function completely transfers ownership from str2 to str by: 1. Adding all elements from str2 to str 2. Freeing the memory allocated for str2->data 3. Resetting all fields of str2 to 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)
- 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