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