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

[Minios-devel] [UNIKRAFT PATCH 3/3] lib/nolibc/string: fix checkpatch issues in strlcpy and strlcat



Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
 lib/nolibc/string.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/lib/nolibc/string.c b/lib/nolibc/string.c
index 0a22c1a..373e5fd 100644
--- a/lib/nolibc/string.c
+++ b/lib/nolibc/string.c
@@ -297,17 +297,26 @@ size_t strlcpy(char *d, const char *s, size_t n)
        size_t *wd;
        const size_t *ws;
 
-       if (!n--) goto finish;
+       if (!n--)
+               goto finish;
+
        if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) {
-               for (; ((uintptr_t)s & ALIGN) && n && (*d=*s); n--, s++, d++);
+               for (; ((uintptr_t) s & ALIGN) && n && (*d = *s);
+                    n--, s++, d++)
+                       ;
+
                if (n && *s) {
-                       wd=(void *)d; ws=(const void *)s;
-                       for (; n>=sizeof(size_t) && !HASZERO(*ws);
-                              n-=sizeof(size_t), ws++, wd++) *wd = *ws;
-                       d=(void *)wd; s=(const void *)ws;
+                       wd = (void *)d; ws = (const void *)s;
+                       for (; n >= sizeof(size_t) && !HASZERO(*ws);
+                            n -= sizeof(size_t), ws++, wd++)
+                               *wd = *ws;
+
+                       d = (void *)wd; s = (const void *)ws;
                }
        }
-       for (; n && (*d=*s); n--, s++, d++);
+
+       for (; n && (*d = *s); n--, s++, d++)
+               ;
        *d = 0;
 finish:
        return d-d0 + strlen(s);
@@ -316,6 +325,7 @@ finish:
 size_t strlcat(char *d, const char *s, size_t n)
 {
        size_t l = strnlen(d, n);
-       if (l == n) return l + strlen(s);
+       if (l == n)
+               return l + strlen(s);
        return l + strlcpy(d+l, s, n-l);
 }
-- 
2.19.2


_______________________________________________
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®.