From 30a419afc3cdb641e350c7cfde753877675958e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Sat, 30 Jan 2010 22:28:49 -0200 Subject: improve readability of string: fix indentation and remove trailing spaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Goddard Rosa --- libc/string/strcasecmp.c | 4 ++-- libc/string/strchr.c | 2 +- libc/string/strcoll.c | 2 +- libc/string/strlcat.c | 4 ++-- libc/string/strlcpy.c | 2 +- libc/string/strncat.c | 2 +- libc/string/strncmp.c | 3 +-- libc/string/strncpy.c | 4 ++-- libc/string/strpbrk.c | 2 +- libc/string/strrchr.c | 4 ++-- libc/string/strsep.c | 2 +- libc/string/strstr.c | 2 +- libc/string/strxfrm.c | 2 +- 13 files changed, 17 insertions(+), 18 deletions(-) diff --git a/libc/string/strcasecmp.c b/libc/string/strcasecmp.c index 12f3a09..2be0913 100644 --- a/libc/string/strcasecmp.c +++ b/libc/string/strcasecmp.c @@ -98,8 +98,8 @@ strncasecmp(const char *s1, const char *s2, size_t n) if (cm[*us1] != cm[*us2++]) return (cm[*us1] - cm[*--us2]); if (*us1++ == '\0') - break; + break; } while (--n != 0); - } + } return (0); } diff --git a/libc/string/strchr.c b/libc/string/strchr.c index e33694c..31ba4e2 100644 --- a/libc/string/strchr.c +++ b/libc/string/strchr.c @@ -38,6 +38,6 @@ strchr(const char *p, int ch) return((char *)p); if (!*p) return((char *)NULL); - } + } /* NOTREACHED */ } diff --git a/libc/string/strcoll.c b/libc/string/strcoll.c index 365cad5..e3b1ec3 100755 --- a/libc/string/strcoll.c +++ b/libc/string/strcoll.c @@ -36,5 +36,5 @@ int strcoll(const char *s1, const char *s2) { - return strcmp (s1, s2); + return strcmp(s1, s2); } diff --git a/libc/string/strlcat.c b/libc/string/strlcat.c index ad2215b..ceab094 100644 --- a/libc/string/strlcat.c +++ b/libc/string/strlcat.c @@ -46,9 +46,9 @@ strlcat(char *dst, const char *src, size_t siz) if (n != 1) { *d++ = *s; n--; - } + } s++; - } + } *d = '\0'; return(dlen + (s - src)); /* count does not include NUL */ diff --git a/libc/string/strlcpy.c b/libc/string/strlcpy.c index 38277eb..d32b659 100644 --- a/libc/string/strlcpy.c +++ b/libc/string/strlcpy.c @@ -37,7 +37,7 @@ strlcpy(char *dst, const char *src, size_t siz) if ((*d++ = *s++) == '\0') break; } - } + } /* Not enough room in dst, add NUL and traverse rest of src */ if (n == 0) { diff --git a/libc/string/strncat.c b/libc/string/strncat.c index 1cb9405..c4df4f2 100644 --- a/libc/string/strncat.c +++ b/libc/string/strncat.c @@ -52,6 +52,6 @@ strncat(char *dst, const char *src, size_t n) d++; } while (--n != 0); *d = 0; - } + } return (dst); } diff --git a/libc/string/strncmp.c b/libc/string/strncmp.c index 9da41ab..1768808 100644 --- a/libc/string/strncmp.c +++ b/libc/string/strncmp.c @@ -38,14 +38,13 @@ int strncmp(const char *s1, const char *s2, size_t n) { - if (n == 0) return (0); do { if (*s1 != *s2++) return (*(unsigned char *)s1 - *(unsigned char *)--s2); if (*s1++ == 0) - break; + break; } while (--n != 0); return (0); } diff --git a/libc/string/strncpy.c b/libc/string/strncpy.c index b91091b..4426cbe 100644 --- a/libc/string/strncpy.c +++ b/libc/string/strncpy.c @@ -54,8 +54,8 @@ strncpy(char *dst, const char *src, size_t n) /* NUL pad the remaining n-1 bytes */ while (--n != 0) *d++ = 0; - break; - } + break; + } } while (--n != 0); } return (dst); diff --git a/libc/string/strpbrk.c b/libc/string/strpbrk.c index 6ba3796..cd3b71c 100644 --- a/libc/string/strpbrk.c +++ b/libc/string/strpbrk.c @@ -38,7 +38,7 @@ strpbrk(const char *s1, const char *s2) { const char *scanp; int c, sc; - + while ((c = *s1++) != 0) { for (scanp = s2; (sc = *scanp++) != 0;) if (sc == c) diff --git a/libc/string/strrchr.c b/libc/string/strrchr.c index 2800781..4918f82 100644 --- a/libc/string/strrchr.c +++ b/libc/string/strrchr.c @@ -34,12 +34,12 @@ char * strrchr(const char *p, int ch) { char *save; - + for (save = NULL;; ++p) { if (*p == ch) save = (char *)p; if (!*p) return(save); - } + } /* NOTREACHED */ } diff --git a/libc/string/strsep.c b/libc/string/strsep.c index bcca681..c44bc5b 100644 --- a/libc/string/strsep.c +++ b/libc/string/strsep.c @@ -34,7 +34,7 @@ /* * Get next token from string *stringp, where tokens are possibly-empty - * strings separated by characters from delim. + * strings separated by characters from delim. * * Writes NULs into the string at *stringp to end tokens. * delim need not remain constant from call to call. diff --git a/libc/string/strstr.c b/libc/string/strstr.c index debe96c..95a865b 100644 --- a/libc/string/strstr.c +++ b/libc/string/strstr.c @@ -51,6 +51,6 @@ strstr(const char *s, const char *find) } while (sc != c); } while (strncmp(s, find, len) != 0); s--; - } + } return ((char *)s); } diff --git a/libc/string/strxfrm.c b/libc/string/strxfrm.c index f1843b5..3c4d707 100755 --- a/libc/string/strxfrm.c +++ b/libc/string/strxfrm.c @@ -29,7 +29,7 @@ /* * Transform string s2 to string s1 using the current locale so that - * strcmp of transformed strings yields the same result as strcoll. + * strcmp of transformed strings yields the same result as strcoll. * Since Bionic really does not support locales, we assume we always use * the C locale. * -- cgit v1.1