EXPLAIN_VASPRINTF_OR_DIE(3)

πŸ“¦
version 1.4.D001 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

πŸ’– explain_vasprintf_or_die(3) πŸ’–

okay bestie, so this one lives in the Library Functions Manual and it's literally called explain_vasprintf_or_die β€” yes the name is dramatic, no we are not changing it 🫢


✨ NAME ✨

explain_vasprintf_or_die β€” print to allocated string and report errors πŸ’…


🌸 SYNOPSIS 🌸

#include <libexplain/vasprintf.h>
int explain_vasprintf_or_die(char **data, const char *format, va_list
ap);
int explain_vasprintf_on_error(char **data, const char *format, va_list
ap);

πŸ¦‹ DESCRIPTION πŸ¦‹

so there's two of them and they're siblings, not twins, okay? let's get into it πŸŽ€

The explain_vasprintf_or_die function is used to call the vasprintf(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_vasprintf(3) function, and then the process terminates by calling exit(EXIT_FAILURE). so like. it dies. on brand, honestly πŸ’€

The explain_vasprintf_on_error function is used to call the vasprintf(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_vasprintf(3) function, but still returns to the caller. it's giving "I'll tell you what went wrong but I'm not gonna end you over it" ✨

  • data β€” the data, exactly as to be passed to the vasprintf(3) system call. yes, exactly. don't get cute with it πŸ™ˆ
  • format β€” the format, exactly as to be passed to the vasprintf(3) system call. same energy, same rule πŸ’–
  • ap β€” the ap, exactly as to be passed to the vasprintf(3) system call. all three of them? passed through untouched. iconic behavior, no notes πŸ‘‘

🌈 RETURN VALUE 🌈

The explain_vasprintf_or_die function only returns on success, see vasprintf(3) for more information. On failure, prints an explanation and exits, it does not return. like. it's not coming back. periodt πŸ’…

The explain_vasprintf_on_error function always returns the value return by the wrapped vasprintf(3) system call. always. every time. no cap 🫢


πŸ“ EXAMPLE πŸ“

The explain_vasprintf_or_die function is intended to be used in a fashion similar to the following example:

int result = explain_vasprintf_or_die(data, format, ap);

that's it. that's the whole vibe. copy it, love it, ship it πŸŽ€


πŸ’œ SEE ALSO πŸ’œ


libexplain version 1.4 Copyright (C) 2013 Peter Miller


and that's the whole page bestie!! πŸ¦‹βœ¨ this was libexplain version 1.4, copyright vibes belonging to Peter Miller in 2013, and we are obsessed. go forth and vasprintf responsibly, mwah πŸ’–πŸ’…πŸŒΈ

πŸ“¦ where this page comes from