StrMergeL

Table of Contents

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.

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

NameDirectionDescription
strin,outStr to insert array chars into.
str2in,outStr to be inserted and reset.

Success

str

Failure

NULL

Usage example (Cross-references)

    // Test StrMergeL function
    bool test_str_merge_l(void) {
    printf("Testing StrMergeL\n");
    
    Str s1 = StrInitFromZstr("Hello");
    
    // Merge s2 into s1 (L-value semantics)
    StrMergeL(&s1, &s2);
    
    // Validate both vectors

Share :