Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (36 sloc) 704 Bytes
* linux/lib/kasprintf.c
* Copyright (C) 1991, 1992 Linus Torvalds
#include <stdarg.h>
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/string.h>
/* Simplified asprintf. */
char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap)
unsigned int len;
char *p;
va_list aq;
va_copy(aq, ap);
len = vsnprintf(NULL, 0, fmt, aq);
p = kmalloc(len+1, gfp);
if (!p)
return NULL;
vsnprintf(p, len+1, fmt, ap);
return p;
char *kasprintf(gfp_t gfp, const char *fmt, ...)
va_list ap;
char *p;
va_start(ap, fmt);
p = kvasprintf(gfp, fmt, ap);
return p;
Jump to Line
Something went wrong with that request. Please try again.