svn commit: r188109 - projects/tcp_cc_8.x/sys/netinet

Lawrence Stewart lstewart at FreeBSD.org
Tue Feb 3 16:45:26 PST 2009


Author: lstewart
Date: Wed Feb  4 00:45:25 2009
New Revision: 188109
URL: http://svn.freebsd.org/changeset/base/188109

Log:
  Explicitly compare against NULL.

Modified:
  projects/tcp_cc_8.x/sys/netinet/cc.c
  projects/tcp_cc_8.x/sys/netinet/cc_cubic.c
  projects/tcp_cc_8.x/sys/netinet/cc_htcp.c
  projects/tcp_cc_8.x/sys/netinet/tcp_input.c
  projects/tcp_cc_8.x/sys/netinet/tcp_output.c
  projects/tcp_cc_8.x/sys/netinet/tcp_subr.c
  projects/tcp_cc_8.x/sys/netinet/tcp_timer.c
  projects/tcp_cc_8.x/sys/netinet/tcp_usrreq.c

Modified: projects/tcp_cc_8.x/sys/netinet/cc.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/cc.c	Wed Feb  4 00:21:36 2009	(r188108)
+++ projects/tcp_cc_8.x/sys/netinet/cc.c	Wed Feb  4 00:45:25 2009	(r188109)
@@ -84,7 +84,7 @@ cc_default_algorithm(SYSCTL_HANDLER_ARGS
 {
 	struct cc_algo *funcs;
 
-	if (!req->newptr)
+	if (req->newptr == NULL)
 		goto skip;
 
 	CC_LIST_RLOCK();
@@ -215,9 +215,9 @@ cc_deregister_algorithm(struct cc_algo *
 					 * using the deregistered algo's functions...
 					 * Not sure how to do that yet!
 					 */
-					if(CC_ALGO(tp)->init)
+					if(CC_ALGO(tp)->init != NULL)
 						CC_ALGO(tp)->init(tp);
-					if (tmpfuncs->deinit)
+					if (tmpfuncs->deinit != NULL)
 						tmpfuncs->deinit(tp);
 				}
 			}

Modified: projects/tcp_cc_8.x/sys/netinet/cc_cubic.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/cc_cubic.c	Wed Feb  4 00:21:36 2009	(r188108)
+++ projects/tcp_cc_8.x/sys/netinet/cc_cubic.c	Wed Feb  4 00:45:25 2009	(r188109)
@@ -147,7 +147,7 @@ cubic_init(struct tcpcb *tp)
 void
 cubic_deinit(struct tcpcb *tp)
 {
-	if (CC_DATA(tp))
+	if (CC_DATA(tp) != NULL)
 		free(CC_DATA(tp), M_CUBIC);
 }
 

Modified: projects/tcp_cc_8.x/sys/netinet/cc_htcp.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/cc_htcp.c	Wed Feb  4 00:21:36 2009	(r188108)
+++ projects/tcp_cc_8.x/sys/netinet/cc_htcp.c	Wed Feb  4 00:45:25 2009	(r188109)
@@ -214,7 +214,7 @@ htcp_deinit(struct tcpcb *tp)
 	printf("deinitialising tcp connection with htcp congestion control\n");
 #endif
 	
-	if (CC_DATA(tp))
+	if (CC_DATA(tp) != NULL)
 		FREE(CC_DATA(tp), M_HTCP);
 }
 
@@ -491,7 +491,7 @@ htcp_ssthresh_update(struct tcpcb *tp)
 static int
 htcp_rtt_scaling_handler(SYSCTL_HANDLER_ARGS)
 {
-	if(!req->newptr)
+	if(req->newptr == NULL)
 		goto skip;
 
 	/* if the value passed in isn't 0 or 1, return an error */
@@ -505,7 +505,7 @@ skip:
 static int
 htcp_adaptive_backoff_handler(SYSCTL_HANDLER_ARGS)
 {
-	if(!req->newptr)
+	if(req->newptr == NULL)
 		goto skip;
 
 	/* if the value passed in isn't 0 or 1, return an error */
@@ -520,7 +520,7 @@ skip:
 static int
 htcp_debug_ticks_handler(SYSCTL_HANDLER_ARGS)
 {
-	if(!req->newptr)
+	if(req->newptr == NULL)
 		goto skip;
 
 	/* if the value passed in is less than 1 */

Modified: projects/tcp_cc_8.x/sys/netinet/tcp_input.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/tcp_input.c	Wed Feb  4 00:21:36 2009	(r188108)
+++ projects/tcp_cc_8.x/sys/netinet/tcp_input.c	Wed Feb  4 00:45:25 2009	(r188109)
@@ -2106,7 +2106,7 @@ tcp_do_segment(struct mbuf *m, struct tc
 					 * defined a hook for tasks to run
 					 * before entering FR, call it
 					 */
-					if (CC_ALGO(tp)->pre_fr)
+					if (CC_ALGO(tp)->pre_fr != NULL)
 						CC_ALGO(tp)->pre_fr(tp, th);
 
 					ENTER_FASTRECOVERY(tp);
@@ -2182,7 +2182,7 @@ tcp_do_segment(struct mbuf *m, struct tc
 				else
 					tcp_newreno_partial_ack(tp, th);
 			} else {
-				if (CC_ALGO(tp)->post_fr)
+				if (CC_ALGO(tp)->post_fr != NULL)
 					CC_ALGO(tp)->post_fr(tp, th);
 			}
 		}
@@ -2288,7 +2288,7 @@ process_ACK:
 		 * congestion control algorithm in use for this connection.
 		 */
 		if (!IN_FASTRECOVERY(tp)) {
-			if (CC_ALGO(tp)->ack_received)
+			if (CC_ALGO(tp)->ack_received != NULL)
 				CC_ALGO(tp)->ack_received(tp, th);
 		}
 		SOCKBUF_LOCK(&so->so_snd);
@@ -3270,7 +3270,7 @@ tcp_mss(struct tcpcb *tp, int offer)
 		tp->snd_bandwidth = metrics.rmx_bandwidth;
 
 	/* set the initial cwnd value */
-	if (CC_ALGO(tp)->cwnd_init)
+	if (CC_ALGO(tp)->cwnd_init != NULL)
 		CC_ALGO(tp)->cwnd_init(tp);
 
 	/* Check the interface for TSO capabilities. */

Modified: projects/tcp_cc_8.x/sys/netinet/tcp_output.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/tcp_output.c	Wed Feb  4 00:21:36 2009	(r188108)
+++ projects/tcp_cc_8.x/sys/netinet/tcp_output.c	Wed Feb  4 00:45:25 2009	(r188109)
@@ -172,7 +172,7 @@ tcp_output(struct tcpcb *tp)
 	idle = (tp->t_flags & TF_LASTIDLE) || (tp->snd_max == tp->snd_una);
 	if (idle && (ticks - tp->t_rcvtime) >= tp->t_rxtcur) {
 		/* reset cwnd after a period of idleness */
-		if (CC_ALGO(tp)->after_idle)
+		if (CC_ALGO(tp)->after_idle != NULL)
 			CC_ALGO(tp)->after_idle(tp);
 	}
 	tp->t_flags &= ~TF_LASTIDLE;

Modified: projects/tcp_cc_8.x/sys/netinet/tcp_subr.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/tcp_subr.c	Wed Feb  4 00:21:36 2009	(r188108)
+++ projects/tcp_cc_8.x/sys/netinet/tcp_subr.c	Wed Feb  4 00:45:25 2009	(r188109)
@@ -874,7 +874,7 @@ tcp_discardcb(struct tcpcb *tp)
 	tcp_free_sackholes(tp);
 
 	/* Allow the cc algorithm in use for this cb to clean up after itself */
-	if (CC_ALGO(tp)->deinit)
+	if (CC_ALGO(tp)->deinit != NULL)
 		CC_ALGO(tp)->deinit(tp);
 
 	CC_ALGO(tp) = NULL;

Modified: projects/tcp_cc_8.x/sys/netinet/tcp_timer.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/tcp_timer.c	Wed Feb  4 00:21:36 2009	(r188108)
+++ projects/tcp_cc_8.x/sys/netinet/tcp_timer.c	Wed Feb  4 00:45:25 2009	(r188109)
@@ -555,7 +555,7 @@ tcp_timer_rexmt(void * xtp)
 	 */
 	tp->t_rtttime = 0;
 
-	if (CC_ALGO(tp)->after_timeout)
+	if (CC_ALGO(tp)->after_timeout != NULL)
 		CC_ALGO(tp)->after_timeout(tp);
 
 	tp->t_dupacks = 0;

Modified: projects/tcp_cc_8.x/sys/netinet/tcp_usrreq.c
==============================================================================
--- projects/tcp_cc_8.x/sys/netinet/tcp_usrreq.c	Wed Feb  4 00:21:36 2009	(r188108)
+++ projects/tcp_cc_8.x/sys/netinet/tcp_usrreq.c	Wed Feb  4 00:45:25 2009	(r188109)
@@ -1397,7 +1397,7 @@ tcp_ctloutput(struct socket *so, struct 
 					 * so it's safe to do these things
 					 * without ordering concerns
 					 */
-					if (CC_ALGO(tp)->deinit)
+					if (CC_ALGO(tp)->deinit != NULL)
 						CC_ALGO(tp)->deinit(tp);
 					CC_ALGO(tp) = cc_algo;
 					/*


More information about the svn-src-projects mailing list