[PATCH] trivial warning fix and whitespace cleanup for arch/i386/boot/compressed/misc.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's a trivial patch to fix two tiny gcc -W warnings:
arch/i386/boot/compressed/misc.c:213: warning: comparison between signed and unsigned
arch/i386/boot/compressed/misc.c:223: warning: comparison between signed and unsigned
In both cases the automatic variable 'i' of type int is compared to a 
function argument of type 'size_t' and then used as array index. Since the 
array index can never sanely be negative an unsigned type makes sense, and 
it further makes sense to then use the same type for the local automatic 
variable as the type it's compared to.  This patch fixes the warning by 
changing the type of 'i' to size_t, and it also makes a small whitespace 
cleanup by breaking two statements on same line (in the same functions) 
into two sepperate lines to improve readability.


Signed-off-by: Jesper Juhl <[email protected]>
---

 arch/i386/boot/compressed/misc.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

--- linux-2.6.12-rc6-mm1-orig/arch/i386/boot/compressed/misc.c	2005-06-12 15:58:34.000000000 +0200
+++ linux-2.6.12-rc6-mm1/arch/i386/boot/compressed/misc.c	2005-06-16 00:00:56.000000000 +0200
@@ -207,20 +207,22 @@ static void putstr(const char *s)
 
 static void* memset(void* s, int c, size_t n)
 {
-	int i;
+	size_t i;
 	char *ss = (char*)s;
 
-	for (i=0;i<n;i++) ss[i] = c;
+	for (i = 0; i < n; i++)
+		ss[i] = c;
 	return s;
 }
 
 static void* memcpy(void* __dest, __const void* __src,
 			    size_t __n)
 {
-	int i;
+	size_t i;
 	char *d = (char *)__dest, *s = (char *)__src;
 
-	for (i=0;i<__n;i++) d[i] = s[i];
+	for (i = 0; i < __n; i++)
+		d[i] = s[i];
 	return __dest;
 }
 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux