Module Name:    src
Committed By:   tsutsui
Date:           Sat Apr 18 15:20:06 UTC 2009

Modified Files:
        src/sys/net: slcompress.c

Log Message:
Use memcmp(9) and memcpy(9) directly rather than via
local BCMP() and BCOPY() macro.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/net/slcompress.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/slcompress.c
diff -u src/sys/net/slcompress.c:1.37 src/sys/net/slcompress.c:1.38
--- src/sys/net/slcompress.c:1.37	Sat Apr 18 14:58:05 2009
+++ src/sys/net/slcompress.c	Sat Apr 18 15:20:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: slcompress.c,v 1.37 2009/04/18 14:58:05 tsutsui Exp $   */
+/*	$NetBSD: slcompress.c,v 1.38 2009/04/18 15:20:06 tsutsui Exp $   */
 /*	Id: slcompress.c,v 1.3 1996/05/24 07:04:47 paulus Exp 	*/
 
 /*
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: slcompress.c,v 1.37 2009/04/18 14:58:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: slcompress.c,v 1.38 2009/04/18 15:20:06 tsutsui Exp $");
 
 #include "opt_inet.h"
 #ifdef INET
@@ -62,9 +62,6 @@
 #define INCR(counter)
 #endif
 
-#define BCMP(p1, p2, n) memcmp((char *)(p1), (char *)(p2), (int)(n))
-#define BCOPY(p1, p2, n) memcpy((char *)(p2), (char *)(p1), (int)(n))
-
 
 void
 sl_compress_init(struct slcompress *comp)
@@ -282,9 +279,9 @@
 	    ((uint16_t *)ip)[4] != ((uint16_t *)&cs->cs_ip)[4] ||
 	    th->th_off != oth->th_off ||
 	    (deltaS > 5 &&
-	     BCMP(ip + 1, &cs->cs_ip + 1, (deltaS - 5) << 2)) ||
+	     memcmp(ip + 1, &cs->cs_ip + 1, (deltaS - 5) << 2)) ||
 	    (th->th_off > 5 &&
-	     BCMP(th + 1, oth + 1, (th->th_off - 5) << 2)))
+	     memcmp(th + 1, oth + 1, (th->th_off - 5) << 2)))
 		goto uncompressed;
 
 	/*
@@ -381,7 +378,7 @@
 	 * state with this packet's header.
 	 */
 	deltaA = ntohs(th->th_sum);
-	BCOPY(ip, &cs->cs_ip, hlen);
+	memcpy(&cs->cs_ip, ip, hlen);
 
 	/*
 	 * We want to use the original packet as our compressed packet.
@@ -409,7 +406,7 @@
 	m->m_data += hlen;
 	*cp++ = deltaA >> 8;
 	*cp++ = deltaA;
-	BCOPY(new_seq, cp, deltaS);
+	memcpy(cp, new_seq, deltaS);
 	INCR(sls_compressed)
 	return (TYPE_COMPRESSED_TCP);
 
@@ -419,7 +416,7 @@
 	 * to use on future compressed packets in the protocol field).
 	 */
 uncompressed:
-	BCOPY(ip, &cs->cs_ip, hlen);
+	memcpy(&cs->cs_ip, ip, hlen);
 	ip->ip_p = cs->cs_id;
 	comp->last_xmit = cs->cs_id;
 	return (TYPE_UNCOMPRESSED_TCP);
@@ -458,7 +455,7 @@
 	}
 	cp -= hlen;
 	len += hlen;
-	BCOPY(hdr, cp, hlen);
+	memcpy(cp, hdr, hlen);
 
 	*bufp = cp;
 	return (len);
@@ -504,7 +501,7 @@
 		hlen += ((struct tcphdr *)&((char *)ip)[hlen])->th_off << 2;
 		if (hlen > MAX_HDR || hlen > buflen)
 			goto bad;
-		BCOPY(ip, &cs->cs_ip, hlen);
+		memcpy(&cs->cs_ip, ip, hlen);
 		cs->cs_hlen = hlen;
 		INCR(sls_uncompressedin)
 		*hdrp = (u_char *) &cs->cs_ip;

Reply via email to