aboutsummaryrefslogtreecommitdiff
path: root/extras/extract_one.c
AgeCommit message (Collapse)Author
2023-09-19Fix example code to use iterator/stream based APIDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-09-08libsqfs: bring sqfs_file_t in line with stream APIDavid Oberhollenzer
Rename the open function to sqfs_file_open, use an argument for the return pointer and pass back and error number on failure. Also add an inermediate function to open an sqfs_file_t using a handle, similar to the stream API. The get_file_size function is moved to the native wrappers and some of the implementation is cleaned up a little. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2023-01-19Implement rudimentary reference counting for sqfs_object_tDavid Oberhollenzer
Implement grab/drop functions to increase/decrease reference count and destroy the object if the count drops to 0. Make sure that all objects that maintain internal references actually grab that reference, duplicate it in the copy function, drop it in the destroy handler. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2022-03-30sqfs_dir_tree_destroy/sqfs_destroy: allow NULL inputLuca Boccassi
Many library destructor functions (like free()) allow a NULL pointer as input, and do nothing in that case. This allows easier cleanup patterns: initialize pointers to NULL and then always pass them to the destroyer functions, no need for verbose goto/if-else patterns. Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2021-08-15Fix explicit NULL derference for the extract-one exampleDavid Oberhollenzer
On the 1.1.x branch, the upstream "allow delete if NULL" patch is not applied, so this needs an explcit fix. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2021-08-12Add a simple example to show how to extract a single text fileLuca Boccassi
Licensed under 0BSD: https://opensource.org/licenses/0BSD Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>