Branch data Line data Source code
1 : : #include "mem.h"
2 : : #include "mem_internal.h"
3 : :
4 : : /**
5 : : * @brief Append one zero-terminated source string as a new inline element in a descriptor-backed string array
6 : : *
7 : : * This is the thin unbounded wrapper for @ref m_string_array_append. Use it
8 : : * when the source is already terminated by a zero-valued element of width
9 : : * @p single_element_size and the helper may scan until that terminator
10 : : *
11 : : * A `NULL` source is accepted and produces an empty appended string, matching
12 : : * the replace semantics of @ref mem_copy_unbounded_string
13 : : *
14 : : * Small example:
15 : : * @code
16 : : * m_create(memory,string_array);
17 : : *
18 : : * if((TRIUMPH & m_string_array_append(string_array,char,"delta")) == 0) { return FAILURE; }
19 : : * if((TRIUMPH & m_string_array_append(string_array,char,"epsilon")) == 0) { return FAILURE; }
20 : : * @endcode
21 : : *
22 : : * @param descriptor_array Root data-mode descriptor that stores `memory` elements
23 : : * @param single_element_size Element width in bytes for the appended string descriptor
24 : : * @param source_text Zero-terminated source string interpreted with @p single_element_size
25 : : * @return `SUCCESS` on success; `FAILURE` otherwise
26 : : */
27 : 663 : Return mem_string_array_append_unbounded(
28 : : memory *descriptor_array,
29 : : size_t single_element_size,
30 : : const void *const source_text)
31 : : {
32 : 663 : return(mem_string_array_core(
33 : : SOURCE_UNBOUNDED_STRING,
34 : : descriptor_array,
35 : : single_element_size,
36 : : 0,
37 : : source_text));
38 : : }
|