src/util.c
char *alloc_sprintf(const char *fmt_str, ...)
{
    va_list va_args_tmp, va_args;
    int size;
    char *str;

    va_start(va_args_tmp, fmt_str);
    va_copy(va_args, va_args_tmp);
    size = vsnprintf(NULL, 0, fmt_str, va_args_tmp);
    va_end(va_args_tmp);
    str = malloc(sizeof(*str) * (size + 1));
    vsprintf(str, fmt_str, va_args);
    va_end(va_args);

    return (str);
}
/*
 *  Our own implementation of the asprintf functionality
 */
Our own implementation of the asprintf functionality
Our own implementation of the asprintf functionality
char *alloc_sprintf(const char *fmt_str, ...)
{
    va_list va_args_tmp, va_args;
    int size;
    char *str;
    va_start(va_args_tmp, fmt_str);
    va_copy(va_args, va_args_tmp);
    size = vsnprintf(NULL, 0, fmt_str, va_args_tmp);
    va_end(va_args_tmp);
    str = malloc(sizeof(*str) * (size + 1));
    vsprintf(str, fmt_str, va_args);
    va_end(va_args);
    return (str);
}
char * alloc_sprintf ( const char * fmt_str , ... ) { va_list va_args_tmp , va_args ; int size ; char * str ; va_start ( va_args_tmp , fmt_str ) ; va_copy ( va_args , va_args_tmp ) ; size = vsnprintf ( NULL , 0 , fmt_str , va_args_tmp ) ; va_end ( va_args_tmp ) ; str = malloc ( sizeof ( * str ) * ( size + 1 ) ) ; vsprintf ( str , fmt_str , va_args ) ; va_end ( va_args ) ; return ( str ) ; }
Our own implementation of the asprintf functionality
Our own implementation of the asprintf functionality