ZIP_SOURCE(3)

πŸ“¦
version 1.11.3 Β· 3 versions
, in debian trixie, ubuntu questing

✨ 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:

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? use zip_source_keep(3). for example, if you need the source after zip_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 🌈


πŸ‘‘ 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