From 36b89f8f1272ca940cad5f683f65700f16e4a3be Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 12 Oct 2007 16:49:19 +0000 Subject: [PATCH] Patch by Vasilis Kaoutsis: Style cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22518 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/string/memmove.c | 45 ++++++++++++----------- src/system/libroot/posix/string/strchr.c | 20 +++++----- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/system/libroot/posix/string/memmove.c b/src/system/libroot/posix/string/memmove.c index d0ec2c4be9..1c005ff3a0 100644 --- a/src/system/libroot/posix/string/memmove.c +++ b/src/system/libroot/posix/string/memmove.c @@ -1,7 +1,8 @@ /* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ + * Copyright 2001, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ + #include #include @@ -13,55 +14,56 @@ typedef int word; #define lsize sizeof(word) #define lmask (lsize - 1) -void * -memmove(void *dest, void const *src, size_t count) + +void* +memmove(void* dest, void const* src, size_t count) { - char *d = (char *)dest; - const char *s = (const char *)src; + char* d = (char*)dest; + const char* s = (const char*)src; int len; - if(count == 0 || dest == src) + if (count == 0 || dest == src) return dest; - if((long)d < (long)s) { - if(((long)d | (long)s) & lmask) { + if ((long)d < (long)s) { + if (((long)d | (long)s) & lmask) { // src and/or dest do not align on word boundary - if((((long)d ^ (long)s) & lmask) || (count < lsize)) + if ((((long)d ^ (long)s) & lmask) || (count < lsize)) len = count; // copy the rest of the buffer with the byte mover else len = lsize - ((long)d & lmask); // move the ptrs up to a word boundary count -= len; - for(; len > 0; len--) + for (; len > 0; len--) *d++ = *s++; } - for(len = count / lsize; len > 0; len--) { - *(word *)d = *(word *)s; + for (len = count / lsize; len > 0; len--) { + *(word*)d = *(word*)s; d += lsize; s += lsize; } - for(len = count & lmask; len > 0; len--) + for (len = count & lmask; len > 0; len--) *d++ = *s++; } else { d += count; s += count; - if(((long)d | (long)s) & lmask) { + if (((long)d | (long)s) & lmask) { // src and/or dest do not align on word boundary - if((((long)d ^ (long)s) & lmask) || (count <= lsize)) + if ((((long)d ^ (long)s) & lmask) || (count <= lsize)) len = count; else len = ((long)d & lmask); count -= len; - for(; len > 0; len--) + for (; len > 0; len--) *--d = *--s; } - for(len = count / lsize; len > 0; len--) { + for (len = count / lsize; len > 0; len--) { d -= lsize; s -= lsize; - *(word *)d = *(word *)s; + *(word*)d = *(word*)s; } - for(len = count & lmask; len > 0; len--) + for (len = count & lmask; len > 0; len--) *--d = *--s; } @@ -69,4 +71,3 @@ memmove(void *dest, void const *src, size_t count) } #endif - diff --git a/src/system/libroot/posix/string/strchr.c b/src/system/libroot/posix/string/strchr.c index fec3cd6e92..ff60195566 100644 --- a/src/system/libroot/posix/string/strchr.c +++ b/src/system/libroot/posix/string/strchr.c @@ -1,25 +1,25 @@ /* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ + * Copyright 2001, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ + #include #include -char * -strchr(const char *s, int c) +char* +strchr(const char* s, int c) { - for(; *s != (char) c; ++s) + for (; *s != (char)c; ++s) if (*s == '\0') return NULL; - return (char *)s; + return (char*)s; } -char * -index(const char *s, int c) +char* +index(const char* s, int c) { return strchr(s, c); } -