2 * linux/lib/kasprintf.c
4 * Copyright (C) 1991, 1992 Linus Torvalds
8 #include <linux/module.h>
9 #include <linux/types.h>
10 #include <linux/string.h>
12 /* Simplified asprintf. */
13 char *kvasprintf(gfp_t gfp
, const char *fmt
, va_list ap
)
20 len
= vsnprintf(NULL
, 0, fmt
, aq
);
23 p
= kmalloc(len
+1, gfp
);
27 vsnprintf(p
, len
+1, fmt
, ap
);
31 EXPORT_SYMBOL(kvasprintf
);
33 char *kasprintf(gfp_t gfp
, const char *fmt
, ...)
39 p
= kvasprintf(gfp
, fmt
, ap
);
44 EXPORT_SYMBOL(kasprintf
);