ARCHIVE_READ_FREE(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’– ARCHIVE_READ_FREE(3) πŸ’–

okay bestie, so this is a page from the Library Functions Manual, and the whole vibe is: how to properly say bye-bye to a streaming archive you've been reading πŸ‘‹βœ¨


πŸ“š LIBRARY

Streaming Archive Library (libarchive, -larchive) 🫢


✨ SYNOPSIS ✨

#include <archive.h>

int
archive_read_close(struct archive *);

int
archive_read_finish(struct archive *);

int
archive_read_free(struct archive *);

three little functions, one big cleanup era πŸ’…


🌸 DESCRIPTION 🌸

  • archive_read_close() β€” wraps up the archive and calls the close callback. it's giving graceful exit ✨
  • archive_read_finish() β€” bestie this one is a deprecated synonym for archive_read_free(). the new name showed up with libarchive 3.0. so if your app needs to compile against either libarchive 2 or libarchive 3, you should keep using the archive_read_finish() name. both names are supported until libarchive 4.0 drops β€” and that's not expected to happen any earlier than 2013. so like. we're fine 😌
  • archive_read_free() β€” if you didn't already call archive_read_close() yourself, this one calls it for you, and then releases all the resources. πŸ‘‘
🚨 note, and this one's important: in libarchive 1.x this function was declared to return void, which made it literally impossible to detect certain errors when archive_read_close() got invoked implicitly from inside this function. the declaration was corrected starting with libarchive 2.0. glow-up fr fr πŸ¦‹

πŸŽ€ RETURN VALUES πŸŽ€

These functions return ARCHIVE_OK on success, or ARCHIVE_FATAL. that's it. no in-between, no situationship 😭


πŸ’€ ERRORS πŸ’€

want the deets? detailed error codes and textual descriptions are available from the archive_errno() and archive_error_string() functions. iykyk πŸ”₯


πŸ‘€ SEE ALSO πŸ‘€


Debian β€” February 2, 2012 πŸŽ‚

and that's the whole page bestie, mwah, go free your archives responsibly πŸ’–πŸ«Άβœ¨

πŸ“¦ where this page comes from