NAME
    asprintf, vasprintf - print to allocated string

SYNOPSIS
    #include "asprintf.h"

    int asprintf(char **strp, const char *format, ...);
    int vasprintf(char **strp, const char *format, va_list ap);

MOTIVATION
    From asprintf(3) in Linux Manual Pages:

        If memory allocation wasn't possible, or some other error
        occurs, these functions will return -1, and the contents of
        strp is undefined.

    Therefore, when asprintf returns -1, no one knows whether
    *strp should be passed to free or not.

DESCRIPTION
    Same as in Linux Manual Pages.

RETURN VALUE
    When successful, same as in Linux Manual Pages.

    If memory allocation wasn't possible, or some other error occurs,
    these functions will return -1 and set *strp to be NULL, and
    no memory is allocated.

    If an error occurs after memory is allocated successfully,
    these function calls free for the allocated memory.

SEE ALSO
    malloc(3), printf(3), stdarg(3)

BUGS
    The current implementation calls vsnprintf twice; first call is for
    getting size of memory allocation, and second call is for getting
    output string. When a return value of the second vsnprintf call is
    different from the first, the current implementation considers that
    some error occurred.
