diff options
Diffstat (limited to 'os/strlcat.c')
-rw-r--r-- | os/strlcat.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/os/strlcat.c b/os/strlcat.c index 7d53b0a6a..316dfa9d1 100644 --- a/os/strlcat.c +++ b/os/strlcat.c @@ -14,7 +14,6 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -33,27 +32,27 @@ size_t strlcat(char *dst, const char *src, size_t siz) { - register char *d = dst; - register const char *s = src; - register size_t n = siz; - size_t dlen; + register char *d = dst; + register const char *s = src; + register size_t n = siz; + size_t dlen; - /* Find the end of dst and adjust bytes left but don't go past end */ - while (n-- != 0 && *d != '\0') - d++; - dlen = d - dst; - n = siz - dlen; + /* Find the end of dst and adjust bytes left but don't go past end */ + while (n-- != 0 && *d != '\0') + d++; + dlen = d - dst; + n = siz - dlen; - if (n == 0) - return(dlen + strlen(s)); - while (*s != '\0') { - if (n != 1) { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; + if (n == 0) + return (dlen + strlen(s)); + while (*s != '\0') { + if (n != 1) { + *d++ = *s; + n--; + } + s++; + } + *d = '\0'; - return(dlen + (s - src)); /* count does not include NUL */ + return (dlen + (s - src)); /* count does not include NUL */ } |