提交 850b9247 编写于 作者: J Jesper Juhl 提交者: Linus Torvalds

[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: NJesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 cc75fb71
...@@ -36,7 +36,7 @@ int strnicmp(const char *s1, const char *s2, size_t len) ...@@ -36,7 +36,7 @@ int strnicmp(const char *s1, const char *s2, size_t len)
/* Yes, Virginia, it had better be unsigned */ /* Yes, Virginia, it had better be unsigned */
unsigned char c1, c2; unsigned char c1, c2;
c1 = 0; c2 = 0; c1 = c2 = 0;
if (len) { if (len) {
do { do {
c1 = *s1; c1 = *s1;
...@@ -148,7 +148,6 @@ char *strcat(char *dest, const char *src) ...@@ -148,7 +148,6 @@ char *strcat(char *dest, const char *src)
dest++; dest++;
while ((*dest++ = *src++) != '\0') while ((*dest++ = *src++) != '\0')
; ;
return tmp; return tmp;
} }
EXPORT_SYMBOL(strcat); EXPORT_SYMBOL(strcat);
...@@ -447,7 +446,7 @@ EXPORT_SYMBOL(strsep); ...@@ -447,7 +446,7 @@ EXPORT_SYMBOL(strsep);
*/ */
void *memset(void *s, int c, size_t count) void *memset(void *s, int c, size_t count)
{ {
char *xs = (char *)s; char *xs = s;
while (count--) while (count--)
*xs++ = c; *xs++ = c;
...@@ -468,8 +467,8 @@ EXPORT_SYMBOL(memset); ...@@ -468,8 +467,8 @@ EXPORT_SYMBOL(memset);
*/ */
void *memcpy(void *dest, const void *src, size_t count) void *memcpy(void *dest, const void *src, size_t count)
{ {
char *tmp = (char *)dest; char *tmp = dest;
char *s = (char *)src; char *s = src;
while (count--) while (count--)
*tmp++ = *s++; *tmp++ = *s++;
...@@ -492,13 +491,15 @@ void *memmove(void *dest, const void *src, size_t count) ...@@ -492,13 +491,15 @@ void *memmove(void *dest, const void *src, size_t count)
char *tmp, *s; char *tmp, *s;
if (dest <= src) { if (dest <= src) {
tmp = (char *)dest; tmp = dest;
s = (char *)src; s = src;
while (count--) while (count--)
*tmp++ = *s++; *tmp++ = *s++;
} else { } else {
tmp = (char *)dest + count; tmp = dest;
s = (char *)src + count; tmp += count;
s = src;
s += count;
while (count--) while (count--)
*--tmp = *--s; *--tmp = *--s;
} }
...@@ -540,7 +541,7 @@ EXPORT_SYMBOL(memcmp); ...@@ -540,7 +541,7 @@ EXPORT_SYMBOL(memcmp);
*/ */
void *memscan(void *addr, int c, size_t size) void *memscan(void *addr, int c, size_t size)
{ {
unsigned char *p = (unsigned char *)addr; unsigned char *p = addr;
while (size) { while (size) {
if (*p == c) if (*p == c)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册