lkml.org 
[lkml]   [2001]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] Re: 2.4.14-pre3: some compilerwarnings...
From
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:11    [W:0.044 / U:2.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site