Function sg_stack_graph_add_files

Source
#[no_mangle]
pub extern "C" fn sg_stack_graph_add_files(
    graph: *mut sg_stack_graph,
    count: usize,
    files: *const c_char,
    lengths: *const usize,
    handles_out: *mut sg_file_handle,
)
Expand description

Adds new files to the stack graph. You provide all of the file content concatenated together into a single string, and an array of the lengths of each file. You also provide an output array, which must have the same size as lengths. We will place each file’s handle in the output array.

There can only ever be one file with a particular name in the graph. If you try to add a file with a name that already exists, you’ll get the same handle as a result.

We copy the filenames into the stack graph. The filenames you pass in do not need to outlive the call to this function.

Each filename must be a valid UTF-8 string. If any filename 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.