Commit 850b9247926693454f71e819883f4dc06184e25f
Committed by
Linus Torvalds
1 parent
cc75fb71c0
Exists in
master
and in
7 other branches
[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>
Showing 1 changed file with 11 additions and 10 deletions Side-by-side Diff
lib/string.c
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | /* Yes, Virginia, it had better be unsigned */ |
37 | 37 | unsigned char c1, c2; |
38 | 38 | |
39 | - c1 = 0; c2 = 0; | |
39 | + c1 = c2 = 0; | |
40 | 40 | if (len) { |
41 | 41 | do { |
42 | 42 | c1 = *s1; |
... | ... | @@ -148,7 +148,6 @@ |
148 | 148 | dest++; |
149 | 149 | while ((*dest++ = *src++) != '\0') |
150 | 150 | ; |
151 | - | |
152 | 151 | return tmp; |
153 | 152 | } |
154 | 153 | EXPORT_SYMBOL(strcat); |
... | ... | @@ -447,7 +446,7 @@ |
447 | 446 | */ |
448 | 447 | void *memset(void *s, int c, size_t count) |
449 | 448 | { |
450 | - char *xs = (char *)s; | |
449 | + char *xs = s; | |
451 | 450 | |
452 | 451 | while (count--) |
453 | 452 | *xs++ = c; |
... | ... | @@ -468,8 +467,8 @@ |
468 | 467 | */ |
469 | 468 | void *memcpy(void *dest, const void *src, size_t count) |
470 | 469 | { |
471 | - char *tmp = (char *)dest; | |
472 | - char *s = (char *)src; | |
470 | + char *tmp = dest; | |
471 | + char *s = src; | |
473 | 472 | |
474 | 473 | while (count--) |
475 | 474 | *tmp++ = *s++; |
476 | 475 | |
... | ... | @@ -492,13 +491,15 @@ |
492 | 491 | char *tmp, *s; |
493 | 492 | |
494 | 493 | if (dest <= src) { |
495 | - tmp = (char *)dest; | |
496 | - s = (char *)src; | |
494 | + tmp = dest; | |
495 | + s = src; | |
497 | 496 | while (count--) |
498 | 497 | *tmp++ = *s++; |
499 | 498 | } else { |
500 | - tmp = (char *)dest + count; | |
501 | - s = (char *)src + count; | |
499 | + tmp = dest; | |
500 | + tmp += count; | |
501 | + s = src; | |
502 | + s += count; | |
502 | 503 | while (count--) |
503 | 504 | *--tmp = *--s; |
504 | 505 | } |
... | ... | @@ -540,7 +541,7 @@ |
540 | 541 | */ |
541 | 542 | void *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 | 546 | while (size) { |
546 | 547 | if (*p == c) |