StrMerge
- Macro
- October 8, 2025
Table of Contents
StrMerge
StrMergeDescription
Merge two strings and store the result in first string. By default, this uses R-value semantics (preserves source string). 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 preserves the source string. If you want to transfer ownership and reset the source string, use StrMergeL instead.
Parameters
| Name | Direction | Description |
|---|---|---|
str | in,out | Str to insert array chars into. |
str2 | in | Str to be inserted. |
Success
str
Failure
NULL
Usage example (Cross-references)
- In
Io.c:864:
}
StrPushBackZstr(o, "0x");
StrMerge(o, &hex);
StrDeinit(&hex);
}
- In
Io.c:934:
}
StrPushBackZstr(o, "0x");
StrMerge(o, &hex);
StrDeinit(&hex);
i++;
- In
Io.c:1011:
// Merge the formatted number into output
StrMerge(o, &temp);
StrDeinit(&temp);
- In
Io.c:1103:
// Merge the formatted number into output
StrMerge(o, &temp);
StrDeinit(&temp);
- In
Io.c:1213:
// Merge the formatted number into output
StrMerge(o, &temp);
StrDeinit(&temp);
}
- In
Io.c:2332:
} else {
Str bit_str = BitVecToStr(bv);
StrMerge(o, &bit_str);
StrDeinit(&bit_str);
}
- In
Str.Insert.c:292:
// Test StrMerge function (alias for StrMergeR)
bool test_str_merge(void) {
WriteFmt("Testing StrMerge\n");
Str s1 = StrInitFromZstr("Hello");
- In
Str.Insert.c:298:
// Merge s2 into s1
StrMerge(&s1, &s2);
// Check that the strings were merged correctly
- In
MisraDoc.c:132:
// keep track of current path we're exploring
Str current_path = StrInit();
StrMerge(¤t_path, &dir_name);
SysDirContents dir_contents = SysGetDirContents(dir_name.data);
- In
MisraDoc.c:141:
// create new directory path relative to current directory search path
Str path = StrInit();
StrMerge(&path, ¤t_path);
StrPushBack(&path, '/');
StrMerge(&path, &dir_entry.name);
- In
MisraDoc.c:143:
StrMerge(&path, ¤t_path);
StrPushBack(&path, '/');
StrMerge(&path, &dir_entry.name);
// store the directory name, ownersip transferred
- In
MisraDoc.c:151:
// create complete relative file path
Str path = StrInit();
StrMerge(&path, ¤t_path);
StrPushBack(&path, '/');
StrMerge(&path, &dir_entry.name);
- In
MisraDoc.c:153:
StrMerge(&path, ¤t_path);
StrPushBack(&path, '/');
StrMerge(&path, &dir_entry.name);
// store discovered file name, ownersip transferred
- In
MisraDoc.c:175:
Str output_path = StrInit();
Scope(&output_path, StrDeinit, {
StrMerge(&output_path, &file_path);
LOG_INFO("{}", output_path);
StrReplaceZstr(&output_path, "/", "-", -1);
- In
MisraDoc.c:198:
StrWriteFmt(&md_code, mdHeader, output_path.data, output_path.data, output_path.data);
StrMerge(&md_code, &file_contents);
StrWriteFmt(&md_code, "\n```");
- In
Str.c:342:
case STR_APPEND_STR : {
Str temp = generate_str_from_input(data, offset, size, 20);
StrMerge(str, &temp);
StrDeinit(&temp);
break;
- In
Str.c:424:
case STR_MERGE : {
Str temp = generate_str_from_input(data, offset, size, 20);
StrMerge(str, &temp);
StrDeinit(&temp);
break;
- In
Str.c:453:
case STR_MERGE_STR : {
Str temp = generate_str_from_input(data, offset, size, 20);
StrMerge(str, &temp);
StrDeinit(&temp);
break;