ZIP_SOURCE_GET_ARGS(3)

πŸ“¦
version 1.11.4 Β· 3 versions
, in arch rolling, debian trixie, fedora 43, fedora 44, nixpkgs unstable, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– ZIP_SOURCE_GET_ARGS β€” bestie edition πŸ’–

okay so this is a page from the Library Functions Manual for the libzip fam, and we're talking about ZIP_SOURCE_GET_ARGS β€” the macro whose whole job is validating and casting arguments to a source callback. it's giving bodyguard energy fr fr 🫢


✨ NAME ✨

ZIP_SOURCE_GET_ARGS β€” validate and cast arguments to source callback


πŸ“š LIBRARY

libzip (-lzip) β€” yeah that's the one, link against it bestie πŸ’…


🌸 SYNOPSIS 🌸

#include <zip.h>

type *
ZIP_SOURCE_GET_ARGS(type, void *data, zip_uint64_t len,
    zip_error_t *error);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the plot: ZIP_SOURCE_GET_ARGS() is a macro, and what it does is cast data to a pointer to type. that's it, that's the whole vibe. it's the little safety check that makes sure your callback got the arguments it was actually promised before you start yanking fields out of them ✨


πŸ’« RETURN VALUES πŸ’«

  • on success?? iconic behaviour, it hands you back data πŸ’–
  • in case of error, it returns NULL and sets error β€” so no, you cannot ignore that error pointer, bestie, it's literally doing its job 😭

πŸ’€ ERRORS πŸ’€

ZIP_SOURCE_GET_ARGS() fails if:

  • [ZIP_ER_INVAL] β€” len is less than the size of type. like the buffer is too small for what you're asking for, and it is NOT gonna pretend otherwise.

πŸ‘€ SEE ALSO πŸ‘€

go read those, iykyk 🧚


⭐ HISTORY ⭐

ZIP_SOURCE_GET_ARGS() was added in libzip 1.0 β€” a classic, a legend, an OG πŸŽ€


πŸ‘‘ AUTHORS πŸ‘‘

Dieter Baron <dillo@nih.at> and Thomas Klausner <wiz@gatalith.at> β€” absolute main characters, no cap 🫢


and that's the whole page, bestie!! this one shipped out with the Debian crew on December 18, 2017 β€” mwah, periodt πŸ’…βœ¨