Branch data Line data Source code
1 : : #include "mem.h"
2 : :
3 : : /**
4 : : * @brief Concatenate visible bytes from a bounded source string buffer.
5 : : *
6 : : * The source buffer is normalized into a temporary descriptor with
7 : : * @ref memory_copy_cstring and then appended through @ref memory_concat_strings.
8 : : */
9 : 18 : Return memory_concat_cstring(
10 : : memory *destination,
11 : : const char *source_buffer,
12 : : size_t source_buffer_size)
13 : : {
14 : : /* Status returned by this function through provide()
15 : : Default value assumes successful completion */
16 : 18 : Return status = SUCCESS;
17 : :
18 : 18 : create(char,source_view);
19 : :
20 [ - + ]: 18 : if(destination == NULL)
21 : : {
22 : 0 : report("Memory management; concat_cstring destination must be non-NULL");
23 : 0 : status = FAILURE;
24 : : }
25 : :
26 [ + - - + ]: 18 : run(copy_cstring(source_view,source_buffer,source_buffer_size));
27 : :
28 [ + - - + ]: 18 : run(concat_strings(destination,source_view));
29 : :
30 [ - + - + ]: 18 : call(del(source_view));
31 : :
32 : 18 : provide(status);
33 : : }
|