Example #1
0
int
malloc_snprintf(char *str, size_t size, const char *format, ...)
{
	int ret;
	va_list ap;

	va_start(ap, format);
	ret = malloc_vsnprintf(str, size, format, ap);
	va_end(ap);

	return (ret);
}
Example #2
0
void
malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque,
                const char *format, va_list ap)
{
    char buf[MALLOC_PRINTF_BUFSIZE];

    if (write_cb == NULL) {
        /*
         * The caller did not provide an alternate write_cb callback
         * function, so use the default one.  malloc_write() is an
         * inline function, so use malloc_message() directly here.
         */
        write_cb = je_malloc_message;
        cbopaque = NULL;
    }

    malloc_vsnprintf(buf, sizeof(buf), format, ap);
    write_cb(cbopaque, buf);
}