[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 2/5] lib/nolibc: use a single file for both asprintf and vasprintf


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Wed, 1 Aug 2018 11:02:19 +0300
  • Cc: florian.schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx
  • Delivery-date: Wed, 01 Aug 2018 08:02:36 +0000
  • Ironport-phdr: 9a23:E7Gl5xznW9CoIMbXCy+O+j09IxM/srCxBDY+r6Qd2ukSIJqq85mqBkHD//Il1AaPAd2Fraocw8Pt8InYEVQa5piAtH1QOLdtbDQizfssogo7HcSeAlf6JvO5JwYzHcBFSUM3tyrjaRsdF8nxfUDdrWOv5jAOBBr/KRB1JuPoEYLOksi7ze+/94HSbglSmDaxfa55IQmrownWqsQYm5ZpJLwryhvOrHtIeuBWyn1tKFmOgRvy5dq+8YB6/ShItP0v68BPUaPhf6QlVrNYFygpM3o05MLwqxbOSxaE62YGXWUXlhpIBBXF7A3/U5zsvCb2qvZx1S+HNsDwULs6Wymt771zRRHolikJKjA3/mLQhMNygqJWuw6tqwBlzoLIeoyZKOZyc6XAdt0aX2pBWcNRWjRfD4O7dIsPE+sBPeBFpIf7ulsOtQa+DhSrCezzzT9InWP23aw80+g7FQHGwRQgH88VvXvIt9X5Lr8SUf2uw6XS1zXDaOpb1DHg44bLahAsueyAUL1tfcbLykQiFxnJgkuOpYHnJT+Y2PwBv3WU4uZ9T+6iiG4qpxtvrjWhyMogkJTFi40Lxl3C6C532pw6JceiR05+edOkFZxQuDyEOIZuWcMiRn1ouD49yr0bpZ63ZCgKx4ojxx7Yc/GHbY2I7QjiVOaVOzt3mGlldKinhxav6kes0Pf8Vs6s3FZLqCpKjMXMu2gQ2xHc98SLUPhw80e71TqRyQze6PtILE4smareMZEhw7owlpQJsUTEGy/7gFn5jKiNdkU4++io7f7rYrH7pp+EKo95kR3xMr80lsynHOQ3KRICX3Kc+eikzr3s4VX5QKlWjv0xiqTZtZHaJcIapq6+GA9Zy5ss5AihDzi41NQVhn0HLFNeeBKblIjlIV7PL+7+DfulhFSsijhrzejcPrL9GpXNMmTDkLD5cLZz705czxAzzdFF6JJSEL0BO+78Wk/0tNzZExA5Lxe5w+D5B9ph0oMRQ3mADrWHP6PPqVWI/P4gI/GQZI8JvzbwM+Ml5//rjX8+n18RZ6qp3YYJZ3C+H/VpPV+ZbGHqgtgfDWgKuhAxQ/fwhFKcTD5Zf2yyUL4k5jEnFIKmCp/OR4CwgLyb3Se3BINWZmdCCl+QEXfodIKEW+kXZSKUPMBujjgEWqK6RIM7yx6uqVyy970yK+vS+yoD8J7uytVxz+nSjg0psyx5CYKayW7eYXtzmzYjQCQq3aY3hVFl1x/X2q9jn/1eU9hO/+5hWRx8LYPWifZ9XYOhEjndd8uEHQ71Cu6tBis8G4o8
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Move vasprintf function in asprintf.c and drop vasprintf.c .

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/nolibc/asprintf.c  | 12 ++++++++++++
 lib/nolibc/vasprintf.c | 15 ---------------
 2 files changed, 12 insertions(+), 15 deletions(-)
 delete mode 100644 lib/nolibc/vasprintf.c

diff --git a/lib/nolibc/asprintf.c b/lib/nolibc/asprintf.c
index 4ec8353..edb491d 100644
--- a/lib/nolibc/asprintf.c
+++ b/lib/nolibc/asprintf.c
@@ -1,6 +1,18 @@
 #define _GNU_SOURCE
 #include <stdio.h>
 #include <stdarg.h>
+#include <stdlib.h>
+
+int vasprintf(char **s, const char *fmt, va_list ap)
+{
+       va_list ap2;
+       va_copy(ap2, ap);
+       int 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);
+}
 
 int asprintf(char **s, const char *fmt, ...)
 {
diff --git a/lib/nolibc/vasprintf.c b/lib/nolibc/vasprintf.c
deleted file mode 100644
index 08251bc..0000000
--- a/lib/nolibc/vasprintf.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-
-int vasprintf(char **s, const char *fmt, va_list ap)
-{
-       va_list ap2;
-       va_copy(ap2, ap);
-       int 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);
-}
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.