All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.4.11 min() in tcp.c
@ 2001-10-10 23:44 Chris Wright
  2001-10-10 23:56 ` David S. Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wright @ 2001-10-10 23:44 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

compiling 2.4.11 gives the following warning.

tcp.c:855: warning: comparison of distinct pointer types lacks a cast

the following patch, changes min() to min_t() to make size_t explicit.

thanks,
-chris

--- linux-2.4.11/net/ipv4/tcp.c	Mon Oct  1 09:19:57 2001
+++ linux-2.4.11-min/net/ipv4/tcp.c	Wed Oct 10 16:42:55 2001
@@ -852,7 +852,7 @@
 
 		page = pages[poffset/PAGE_SIZE];
 		offset = poffset % PAGE_SIZE;
-		size = min(psize, PAGE_SIZE-offset);
+		size = min_t (size_t, psize, PAGE_SIZE-offset);
 
 		if (tp->send_head==NULL || (copy = mss_now - skb->len) <= 0) {
 new_segment:

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 2.4.11 min() in tcp.c
  2001-10-10 23:44 [PATCH] 2.4.11 min() in tcp.c Chris Wright
@ 2001-10-10 23:56 ` David S. Miller
  2001-10-11  0:00   ` Chris Wright
  0 siblings, 1 reply; 3+ messages in thread
From: David S. Miller @ 2001-10-10 23:56 UTC (permalink / raw)
  To: chris; +Cc: torvalds, linux-kernel

   From: Chris Wright <chris@wirex.com>
   Date: Wed, 10 Oct 2001 16:44:30 -0700

   tcp.c:855: warning: comparison of distinct pointer types lacks a cast
   
   the following patch, changes min() to min_t() to make size_t explicit.

Applied, but with a cleanup, please never do this:
   
   -		min(
   +		min_t (

"min_t" is not a C operator, therefore no reason to put a space
between "min_t" and the openning parenthesis.  If you look around,
this is the general coding style rule the Linux code follows:

	if ()  /* <--- space here */
	while () /* <--- and here */
	foo_function() /* <--- but not here */

For example.

Franks a lot,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 2.4.11 min() in tcp.c
  2001-10-10 23:56 ` David S. Miller
@ 2001-10-11  0:00   ` Chris Wright
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Wright @ 2001-10-11  0:00 UTC (permalink / raw)
  To: David S. Miller; +Cc: torvalds, linux-kernel

* David S. Miller (davem@redhat.com) wrote:
> 
> Applied, but with a cleanup, please never do this:
>    
>    -		min(
>    +		min_t (

yes, my mistake. thanks.
-chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-10-11  0:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-10 23:44 [PATCH] 2.4.11 min() in tcp.c Chris Wright
2001-10-10 23:56 ` David S. Miller
2001-10-11  0:00   ` Chris Wright

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.