Function stack_graphs::c::sg_stack_graph_add_strings
source · #[no_mangle]
pub extern "C" fn sg_stack_graph_add_strings(
graph: *mut sg_stack_graph,
count: usize,
strings: *const c_char,
lengths: *const usize,
handles_out: *mut sg_string_handle
)
Expand description
Adds new strings to the stack graph. You provide all of the string content concatenated
together into a single string, and an array of the lengths of each string. You also provide an
output array, which must have the same size as lengths
. We will place each string’s handle
in the output array.
We ensure that there is only ever one copy of a particular string stored in the graph — we guarantee that identical strings will have the same handles, meaning that you can compare the handles using simple integer equality.
We copy the string data into the stack graph. The string content you pass in does not need to outlive the call to this function.
Each string must be a valid UTF-8 string. If any string isn’t valid UTF-8, it won’t be added to the stack graph, and the corresponding entry in the output array will be the null handle.