[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Minios-devel] [UNIKRAFT PATCH 4/5] lib/nolibc: fix checkpatch issues for asprintf.c
- To: minios-devel@xxxxxxxxxxxxx
- From: Costin Lupu <costin.lupu@xxxxxxxxx>
- Date: Wed, 1 Aug 2018 11:02:22 +0300
- Cc: florian.schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx
- Delivery-date: Wed, 01 Aug 2018 08:02:36 +0000
- Ironport-phdr: 9a23:+8b73BOacqDk70xyqjMl6mtUPXoX/o7sNwtQ0KIMzox0I///rarrMEGX3/hxlliBBdydt6oazbKO+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxlJiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0yRD+s7bpkSAXwhSkHKTA37W/ZhM93gq1ZrhKsvABzz5LObY2JLvdyYr/RcNUHTmRBRMZRUClBD5uiYosIFOoBIedYr4/grFUIsBu+HRSsD/7oxzBUgX/2xrE60+UnEQ3c2AwgAsoOsGnPodrpL6ceS/i1zLTTwjnZdfNW3i7w5Y7VeR4iufGBRa98fMXMxUU1FA7Ijk+cpZL7Mz6XzOgAvXCX4/dvWO6ykWIqqAF8riKxysoihITFnJ8Zx1/a+Sh/3Y07P8e3SFRhbt6hCJZQsiaaOJZoTc46WGFovTo6yqUBuZ6mYCgG0JQnyADba/yAa4WI/BfjW/yQITd8nn5qZKm/iwyq8Ui90eLwTNO00FFSoipElNnDqGwN2gTO5sWIV/dx5ESs1DaV2wzN9O1JI1o4mKTDJ54k2LEwl54TsUrZHi/xnUX7lLOZdkI/+ui06uTnZK/qppuBN49slwHzKbghmtelDeQgLwgBRHKX+f671LH75032XK1KjuEqkqneqJ3aIMUbpqi4Aw9SyYYv8guwACm40NsGmXkKN1ZFeBOcj4j1IFHCOv/5Aum5g1i2lzdr3f/GNKX7AprRNnjDjKvhfbFl5k5SzAozyspf55NOBbEHOv7zQVP+tNzdDh84LgO03/3qCNNj2YwCXWKAGLSWPLnMvl+V/ugvOfWDZJcJuDbhLPgo/+XujX48mV8ae6mlx5gXaG2mEfRgIkSWf2Dsj8wHEWgUogU+SPblh0aYXTFNena4R7g86S0jCIK6EYfDQZiggbyc3CehH51afH5GCleIEXj0d4WEWPAMaDyJL89njDMLSbyhRJU62h20qgD61ukvEu2B/ywetJX4kdR4+eDXvRUz7iBvSdSQ1SeKVW4nsHkPQmod27tjoEo17kqbzOAsiPtDCd1VofdUShoSPoWa1/FwTcr1DFGSNuyVQUqrF431SQo6Scg8locD
- 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
|