]>
git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - lib/kasprintf.c
2 * linux/lib/kasprintf.c
4 * Copyright (C) 1991, 1992 Linus Torvalds
8 #include <linux/export.h>
9 #include <linux/slab.h>
10 #include <linux/types.h>
11 #include <linux/string.h>
13 /* Simplified asprintf. */
14 char *kvasprintf(gfp_t gfp
, const char *fmt
, va_list ap
)
21 len
= vsnprintf(NULL
, 0, fmt
, aq
);
24 p
= kmalloc_track_caller(len
+1, gfp
);
28 vsnprintf(p
, len
+1, fmt
, ap
);
32 EXPORT_SYMBOL(kvasprintf
);
34 char *kasprintf(gfp_t gfp
, const char *fmt
, ...)
40 p
= kvasprintf(gfp
, fmt
, ap
);
45 EXPORT_SYMBOL(kasprintf
);