ZIP_SOURCE(3)
β¨ NAME β¨
zip_source β the zip data source structure, aka the moment everything clicks π
π LIBRARY π
libzip (-lzip) β that's the girlies, that's the crew π«Ά
π SYNOPSIS π
#include <zip.h>
zip_source_t *zs;
π DESCRIPTION π
okay so listen bestie, a struct zip_source is a data source that libzip(3) uses to add or replace file contents for a file in a zip archive. that's literally its whole job. slay.
and here's the gag: if the source supports seeking, it can ALSO be used to open zip archives from. so it's giving multitasker energy β¨
you make one by calling one of these:
zip_source_buffer(3)zip_source_buffer_create(3)zip_source_file(3)zip_source_file_create(3)zip_source_filep(3)zip_source_filep_create(3)zip_source_function(3)zip_source_function_create(3)zip_source_window(3)zip_source_zip(3)
no cap, that's the whole list. pick your fighter π¦
now, the part you actually need to internalize: zip_source_t is reference counted, and it's created with a reference count of 1. one. uno. the starting number, iconic behavior.
and the way that zip_open_from_source(3), zip_file_add(3), and zip_file_replace(3) work is they'll decrement the reference count of the zip_source_t when they are done using it. so like β they handle it. they take care of it. which means zip_source_free(3) only needs to be called when these functions return an error. that's the only time, bestie. don't be out here freeing when you don't need to π
and if you need to bump that reference count up? usezip_source_keep(3). for example, if you need the source afterzip_close(3). because after the close it's giving ghost π» and you do NOT want to be caught holding a dangling pointer, fr fr π
π SEE ALSO π
libzip(3)zip_source_buffer(3)zip_source_file(3)zip_source_filep(3)zip_source_free(3)zip_source_function(3)zip_source_window(3)zip_source_zip(3)
π AUTHORS π
the absolute legends who made this happen:
- Dieter Baron
<dillo@nih.at> - Thomas Klausner
<wiz@gatalith.at>
and that's the whole vibe check π this page was served up by Debian on December 18, 2017, filed under ZIP_SOURCE(3) β go forth and build your archives, main character ππΈ
π¦ where this page comes from
- debian trixie: libzip-dev 1.11.3-2 Β· BSD-3-Clause
- ubuntu questing: libzip-dev 1.11.3-2
- Copyright (C) 2014-2021 Dieter Baron and Thomas Klausner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms