Skip to contentSkip to conversation

lib stringc cleanup restore useful memmove const

PATCH In review Paul Jackson 2 participants 2 messages Oct 25, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib stringc cleanup restore useful memmove const

A couple of (char *) casts removed in a previous cleanup patch in lib/string.c:memmove() were actually useful, as they suppressed a couple of warnings:

assignment discards qualifiers from pointer target type

Fix by declaring the local variable const in the first place, so casts aren't needed to strip the const qualifier.

---

 lib/string.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)
lib/string.c +2 -1
@@ -488,7 +488,8 @@ EXPORT_SYMBOL(memcpy);
  */
 void *memmove(void *dest, const void *src, size_t count)
 {
-	char *tmp, *s;
+	char *tmp;
+	const char *s;
 
 	if (dest <= src) {
 		tmp = dest;
Signature · 3 lines
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <[email protected]> 1.650.933.1373
#1 lore raw
Quoted 4 lines · Paul Jackson

A couple of (char *) casts removed in a previous cleanup patch in lib/string.c:memmove() were actually useful, as they suppressed a couple of warnings:

Hmm, you are right, I shouldn't have missed that, my bad.

Quoted 5 lines

assignment discards qualifiers from pointer target type

Fix by declaring the local variable const in the first place, so casts aren't needed to strip the const qualifier.

Looks good to me, thank you for fixing that up.

Quoted 1 line

--
Jesper Juhl <[email protected]>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html