mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 15:41:36 +00:00
d0761e37fe
They were in tools/include/linux/kernel.h, requiring that it in turn included stdio.h, which is way too heavy. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-855h8olnkot9v0dajuee1lo3@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
25 lines
539 B
C
25 lines
539 B
C
#include <sys/types.h>
|
|
#include <linux/kernel.h>
|
|
#include <stdio.h>
|
|
|
|
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|
{
|
|
int i = vsnprintf(buf, size, fmt, args);
|
|
ssize_t ssize = size;
|
|
|
|
return (i >= ssize) ? (ssize - 1) : i;
|
|
}
|
|
|
|
int scnprintf(char * buf, size_t size, const char * fmt, ...)
|
|
{
|
|
ssize_t ssize = size;
|
|
va_list args;
|
|
int i;
|
|
|
|
va_start(args, fmt);
|
|
i = vsnprintf(buf, size, fmt, args);
|
|
va_end(args);
|
|
|
|
return (i >= ssize) ? (ssize - 1) : i;
|
|
}
|