[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Minios-devel] [UNIKRAFT PATCH 4/5] lib/nolib.c: fix checkpatch issues for asprintf.c
- To: minios-devel@xxxxxxxxxxxxx
- From: Costin Lupu <costin.lupu@xxxxxxxxx>
- Date: Wed, 1 Aug 2018 11:02:21 +0300
- Cc: florian.schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx
- Delivery-date: Wed, 01 Aug 2018 08:02:36 +0000
- Ironport-phdr: 9a23:LlQrDB8+fnui2/9uRHKM819IXTAuvvDOBiVQ1KB20O4cTK2v8tzYMVDF4r011RmVBduds6oMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2O2+55zebx9UiDahfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMMvrRr42RDui9b9mRh/2hikaOTA382bZhc5+jK9AvB6tuwZyz5LObY2JKPZzeL7Wc9MARWpGW8ZcTzJMAoSnb4sTDuoBO/tToY/gp1sWsBu1GA6hC//oyj9Tmn/23Ks63/4lEQHbxAwgAskDv2jPrNnvLKcSTPu6wLPSzTXEdv5b3yr25ovQch05vP2BUq98fdDSxEQvDQ/JkEucpI7/Mz6bzugBrmeW4/d6We+si2MrsR99rzahy8s2l4XEiZwZx1bZ/itj2ok1P8e3SEtjbN6hF5tfqj+VOpNtQsMnX2FooCE6yqAauZKjfCgF1pAnxxnHZvyZdoiH+BPjVOKLLThkn3JpYqq/hwup/kS60O38UdG40FdMriVbjtnBrm0B2hPO5sSdSfZw/l2t1SiR2w3R8O1JL1g4la/BJJ4gxr4wmIATsUPGHiLuhEr2i7SWdlkl+uiu8ejnZqjmpoeBN4Jvlg7+Kb4imtSiAesjKAQORW+b9fym1LL/5U35XKlKjvoun6ncsZDaI8UbpqmiAwNMz4ks9Qi/ACmi0NkDmXkHLUlFeA6cj4TzNFDBPvb4Ae24g1S2nzdh3+rGMaH5ApXRMnjDl6/sfbh5605b0gozzMpQ55ROBrEaPP3zWkrxtN3FAR8lKAG0xfjoB8l51owEQm2DGLGWML7Ku1+S+u0vO/WMZJMSuDvlMPgl5vvujXg/mVMHfqmpwIUYaHa5H/t4OUWUenzsjckdHmcOpAUxV/bmh0OfUTRLfXa9Q7o85i0nCIKhFYrCRp2tgKaA3CuhAJ1WYWRGBUyMEXfrcIWERewBaCSMLcB9ljwLT6OuR5U/2hGz50fGzO9iL+zV/TZduZ/92dxd4+zIiQp05TFyScOH3DKjVWZxy0gPXCM32uhbvFRgggOI1rNkgvoeEcFL+ttCSUEiKJSa1essWIO6YR7IYtrcEAXued6hGzxkFt8=
- List-id: Mini-os development list <minios-devel.lists.xenproject.org>
Signed-off-by: Costin Lupu <costin.lupu@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.11.0
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|