[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v2 4/5] lib/nolibc: fix checkpatch issues for asprintf.c
From: Costin Lupu <costin.lupu@xxxxxxxxx> Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx> Reviewed-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx> --- lib/nolibc/asprintf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/nolibc/asprintf.c b/lib/nolibc/asprintf.c index 23a2544..905aac3 100644 --- a/lib/nolibc/asprintf.c +++ b/lib/nolibc/asprintf.c @@ -28,18 +28,22 @@ int vasprintf(char **s, const char *fmt, va_list ap) { va_list ap2; + int l; + va_copy(ap2, ap); - int l = vsnprintf(0, 0, fmt, ap2); + l = vsnprintf(0, 0, fmt, ap2); va_end(ap2); - if (l<0 || !(*s=malloc(l+1U))) return -1; - return vsnprintf(*s, l+1U, fmt, ap); + if (l < 0 || !(*s = malloc(l + 1U))) + return -1; + return vsnprintf(*s, l + 1U, fmt, ap); } int asprintf(char **s, const char *fmt, ...) { int ret; va_list ap; + va_start(ap, fmt); ret = vasprintf(s, fmt, ap); va_end(ap); -- 2.17.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |