public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: "linux-kernel" <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
	Ingo Oeser <ioe@informatik.tu-chemnitz.de>,
	Jason Thomas <jason@topic.com.au>,
	Matthew Hawkins <matt@mh.dropbear.id.au>
Subject: [PATCH 3/3] lib/string.c cleanup : remove pointless explicit casts
Date: Fri, 23 Sep 2005 23:53:14 +0200	[thread overview]
Message-ID: <200509232353.14357.jesper.juhl@gmail.com> (raw)
In-Reply-To: <200509232344.26044.jesper.juhl@gmail.com>

Remove a few 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>
---

 lib/string.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

--- linux-2.6.14-rc2-git3/lib/string.c-with-patch-2	2005-09-23 22:46:35.000000000 +0200
+++ linux-2.6.14-rc2-git3/lib/string.c	2005-09-23 23:05:19.000000000 +0200
@@ -36,7 +36,7 @@ int strnicmp(const char *s1, const char 
 	/* Yes, Virginia, it had better be unsigned */
 	unsigned char c1, c2;
 
-	c1 = 0;	c2 = 0;
+	c1 = c2 = 0;
 	if (len) {
 		do {
 			c1 = *s1;
@@ -148,7 +148,6 @@ char *strcat(char *dest, const char *src
 		dest++;
 	while ((*dest++ = *src++) != '\0')
 		;
-
 	return tmp;
 }
 EXPORT_SYMBOL(strcat);
@@ -447,7 +446,7 @@ EXPORT_SYMBOL(strsep);
  */
 void *memset(void *s, int c, size_t count)
 {
-	char *xs = (char *)s;
+	char *xs = s;
 
 	while (count--)
 		*xs++ = c;
@@ -468,8 +467,8 @@ EXPORT_SYMBOL(memset);
  */
 void *memcpy(void *dest, const void *src, size_t count)
 {
-	char *tmp = (char *)dest;
-	char *s = (char *)src;
+	char *tmp = dest;
+	char *s = src;
 
 	while (count--)
 		*tmp++ = *s++;
@@ -492,13 +491,15 @@ void *memmove(void *dest, const void *sr
 	char *tmp, *s;
 
 	if (dest <= src) {
-		tmp = (char *)dest;
-		s = (char *)src;
+		tmp = dest;
+		s = src;
 		while (count--)
 			*tmp++ = *s++;
 	} else {
-		tmp = (char *)dest + count;
-		s = (char *)src + count;
+		tmp = dest;
+		tmp += count;
+		s = src;
+		s += count;
 		while (count--)
 			*--tmp = *--s;
 	}
@@ -540,7 +541,7 @@ EXPORT_SYMBOL(memcmp);
  */
 void *memscan(void *addr, int c, size_t size)
 {
-	unsigned char *p = (unsigned char *)addr;
+	unsigned char *p = addr;
 
 	while (size) {
 		if (*p == c)



      parent reply	other threads:[~2005-09-23 21:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-23 21:44 [PATCH 0/3] lib/string.c cleanup Jesper Juhl
2005-09-23 21:48 ` [PATCH 1/3] lib/string.c cleanup : whitespace and CodingStyle cleanups Jesper Juhl
2005-09-23 23:05   ` Alexey Dobriyan
2005-09-23 23:02     ` Jesper Juhl
2005-09-23 21:51 ` [PATCH 2/3] lib/string.c cleanup : remove pointless register keyword Jesper Juhl
2005-09-23 21:53 ` Jesper Juhl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200509232353.14357.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=akpm@osdl.org \
    --cc=ioe@informatik.tu-chemnitz.de \
    --cc=jason@topic.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@mh.dropbear.id.au \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox