aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2005-10-30 18:02:13 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:19 -0500
commit850b9247926693454f71e819883f4dc06184e25f (patch)
treec8cd596b48666f33864930b0bcde28d6aaf0740d
parentcc75fb71c0100d921637a11ded5e333883be5df3 (diff)
[PATCH] lib/string.c cleanup: remove pointless explicit casts
The first two hunks of the patch really belongs in patch 1, but I missed them on the first pass and instead of redoing all 3 patches I stuck them in this one. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--lib/string.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/string.c b/lib/string.c
index 542829742c85..d7a5ff9b81ea 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -36,7 +36,7 @@ int strnicmp(const char *s1, const char *s2, size_t len)
36 /* Yes, Virginia, it had better be unsigned */ 36 /* Yes, Virginia, it had better be unsigned */
37 unsigned char c1, c2; 37 unsigned char c1, c2;
38 38
39 c1 = 0; c2 = 0; 39 c1 = c2 = 0;
40 if (len) { 40 if (len) {
41 do { 41 do {
42 c1 = *s1; 42 c1 = *s1;
@@ -148,7 +148,6 @@ char *strcat(char *dest, const char *src)
148 dest++; 148 dest++;
149 while ((*dest++ = *src++) != '\0') 149 while ((*dest++ = *src++) != '\0')
150 ; 150 ;
151
152 return tmp; 151 return tmp;
153} 152}
154EXPORT_SYMBOL(strcat); 153EXPORT_SYMBOL(strcat);
@@ -447,7 +446,7 @@ EXPORT_SYMBOL(strsep);
447 */ 446 */
448void *memset(void *s, int c, size_t count) 447void *memset(void *s, int c, size_t count)
449{ 448{
450 char *xs = (char *)s; 449 char *xs = s;
451 450
452 while (count--) 451 while (count--)
453 *xs++ = c; 452 *xs++ = c;
@@ -468,8 +467,8 @@ EXPORT_SYMBOL(memset);
468 */ 467 */
469void *memcpy(void *dest, const void *src, size_t count) 468void *memcpy(void *dest, const void *src, size_t count)
470{ 469{
471 char *tmp = (char *)dest; 470 char *tmp = dest;
472 char *s = (char *)src; 471 char *s = src;
473 472
474 while (count--) 473 while (count--)
475 *tmp++ = *s++; 474 *tmp++ = *s++;
@@ -492,13 +491,15 @@ void *memmove(void *dest, const void *src, size_t count)
492 char *tmp, *s; 491 char *tmp, *s;
493 492
494 if (dest <= src) { 493 if (dest <= src) {
495 tmp = (char *)dest; 494 tmp = dest;
496 s = (char *)src; 495 s = src;
497 while (count--) 496 while (count--)
498 *tmp++ = *s++; 497 *tmp++ = *s++;
499 } else { 498 } else {
500 tmp = (char *)dest + count; 499 tmp = dest;
501 s = (char *)src + count; 500 tmp += count;
501 s = src;
502 s += count;
502 while (count--) 503 while (count--)
503 *--tmp = *--s; 504 *--tmp = *--s;
504 } 505 }
@@ -540,7 +541,7 @@ EXPORT_SYMBOL(memcmp);
540 */ 541 */
541void *memscan(void *addr, int c, size_t size) 542void *memscan(void *addr, int c, size_t size)
542{ 543{
543 unsigned char *p = (unsigned char *)addr; 544 unsigned char *p = addr;
544 545
545 while (size) { 546 while (size) {
546 if (*p == c) 547 if (*p == c)