[PATCH] Re: 2.4.14-pre3: some compilerwarnings...

From: Robert Love (rml@tech9.net)
Date: Sat Oct 27 2001 - 12:30:04 EST


On Sat, 2001-10-27 at 13:16, Robert Love wrote:
> <snip>

Hm, while we are at it, let's cleanup the MIN macros, too...might as
well just use the built-in system min. This patch includes that cleanup
as well as the typecast fix. Ignore the old, apply this, enjoy.

diff -urN linux-2.4.14-pre3/drivers/char/random.c linux/drivers/char/random.c
--- linux-2.4.14-pre3/drivers/char/random.c Sat Oct 27 13:13:03 2001
+++ linux/drivers/char/random.c Sat Oct 27 13:26:34 2001
@@ -406,10 +406,6 @@
  *
  *****************************************************************/
 
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
 /*
  * Unfortunately, while the GCC optimizer for the i386 understands how
  * to optimize a static rotate left of x bits, it doesn't know how to
@@ -1245,8 +1241,9 @@
 
         if (r->entropy_count < nbytes * 8 &&
             r->entropy_count < r->poolinfo.POOLBITS) {
- int nwords = min(r->poolinfo.poolwords - r->entropy_count/32,
- sizeof(tmp) / 4);
+ int nwords = min_t(int,
+ r->poolinfo.poolwords - r->entropy_count/32,
+ sizeof(tmp) / 4);
 
                 DEBUG_ENT("xfer %d from primary to %s (have %d, need %d)\n",
                           nwords * 32,
@@ -1359,7 +1356,7 @@
 #endif
                 
                 /* Copy data to destination buffer */
- i = MIN(nbytes, HASH_BUFFER_SIZE*sizeof(__u32)/2);
+ i = min(nbytes, HASH_BUFFER_SIZE*sizeof(__u32)/2);
                 if (flags & EXTRACT_ENTROPY_USER) {
                         i -= copy_to_user(buf, (__u8 const *)tmp, i);
                         if (!i) {
@@ -1586,7 +1583,7 @@
         size_t c = count;
 
         while (c > 0) {
- bytes = MIN(c, sizeof(buf));
+ bytes = min(c, sizeof(buf));
 
                 bytes -= copy_from_user(&buf, p, bytes);
                 if (!bytes) {

        Robert Love

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



This archive was generated by hypermail 2b29 : Wed Oct 31 2001 - 21:00:33 EST