Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Change bzero -> memset, bcopy -> memcpy.



details:   https://anonhg.NetBSD.org/src/rev/f90fa1236e26
branches:  trunk
changeset: 823764:f90fa1236e26
user:      rjs <rjs%NetBSD.org@localhost>
date:      Sun May 07 21:36:23 2017 +0000

description:
Change bzero -> memset, bcopy -> memcpy.

diffstat:

 sys/netinet/dccp_usrreq.c |  40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diffs (141 lines):

diff -r 6caa502b5a05 -r f90fa1236e26 sys/netinet/dccp_usrreq.c
--- a/sys/netinet/dccp_usrreq.c Sun May 07 21:24:37 2017 +0000
+++ b/sys/netinet/dccp_usrreq.c Sun May 07 21:36:23 2017 +0000
@@ -1,5 +1,5 @@
 /*     $KAME: dccp_usrreq.c,v 1.67 2005/11/03 16:05:04 nishida Exp $   */
-/*     $NetBSD: dccp_usrreq.c,v 1.15 2017/05/07 21:24:37 rjs Exp $ */
+/*     $NetBSD: dccp_usrreq.c,v 1.16 2017/05/07 21:36:23 rjs Exp $ */
 
 /*
  * Copyright (c) 2003 Joacim Häggmark, Magnus Erixzon, Nils-Erik Mattsson 
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.15 2017/05/07 21:24:37 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.16 2017/05/07 21:36:23 rjs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -326,7 +326,7 @@
        } else
 #endif
        {
-               bzero(ipov->ih_x1, sizeof(ipov->ih_x1));
+               memset(ipov->ih_x1, 0, sizeof(ipov->ih_x1));
                ip->ip_len = htons(m->m_pkthdr.len);
                dh->dh_sum = in4_cksum(m, IPPROTO_DCCP, off, cslen);
 
@@ -634,7 +634,7 @@
                }
 
                DCCP_DEBUG((LOG_INFO, "Parsing DCCP options, optlen = %i\n", optlen));
-               bcopy(optp, options, optlen);
+               memcpy(options, optp, optlen);
                dccp_parse_options(dp, options, optlen);
        }
 
@@ -1344,14 +1344,14 @@
        /* Adding options. */
        if (dp->optlen) {
                DCCP_DEBUG((LOG_INFO, "Copying options from dp->options! %u\n", dp->optlen));
-               bcopy(dp->options, options , dp->optlen);
+               memcpy(options, dp->options, dp->optlen);
                optlen = dp->optlen;
                dp->optlen = 0;
        }
 
        if (dp->featlen && (optlen + dp->featlen < DCCP_MAX_OPTIONS)) {
                DCCP_DEBUG((LOG_INFO, "Copying options from dp->features! %u\n", dp->featlen));
-               bcopy(dp->features, options + optlen, dp->featlen);
+               memcpy(options + optlen, dp->features, dp->featlen);
                optlen += dp->featlen;
        }
 
@@ -1450,7 +1450,7 @@
        {
                ip = mtod(m, struct ip *);
                dh = (struct dccphdr *)(ip + 1);
-               bzero(ip, sizeof(struct ip));
+               memset(ip, 0, sizeof(struct ip));
                ip->ip_p = IPPROTO_DCCP;
                ip->ip_src = inp->inp_laddr;
                ip->ip_dst = inp->inp_faddr;
@@ -1541,7 +1541,7 @@
        }
 
        if (optlen)
-               bcopy(options, optp, optlen);
+               memcpy(optp, options, optlen);
 
        m->m_pkthdr.len = hdrlen + len;
 
@@ -2301,7 +2301,7 @@
        dp = pool_get(&dccpcb_pool, PR_NOWAIT);
        if (dp == NULL)
                return NULL;
-       bzero((char *) dp, sizeof(struct dccpcb));
+       memset((char *) dp, 0, sizeof(struct dccpcb));
 
        callout_init(&dp->connect_timer, 0);
        callout_init(&dp->retrans_timer, 0);
@@ -2464,7 +2464,7 @@
                        }
                        /* Feature negotiations are options 33 to 35 */ 
                        DCCP_DEBUG((LOG_INFO, "Got option %u, size = %u, feature = %u\n", opt, size, options[i+2]));
-                       bcopy(options + i + 3, val, size -3);
+                       memcpy(val, options + i + 3, size -3);
                        DCCP_DEBUG((LOG_INFO, "Calling dccp_feature neg(%u, %u, options[%u + 1], %u)!\n", (u_int)dp, opt, i+ 1, (size - 3)));
                        dccp_feature_neg(dp, opt, options[i+2], (size -3) , val);
                        i += size - 1;
@@ -2489,8 +2489,8 @@
                                        DCCP_DEBUG((LOG_INFO, "Got DCCP_OPT_TIMESTAMP, size = %u\n", size));
 
                                        /* Adding TimestampEcho to next outgoing */
-                                       bcopy(options + i + 2, val, 4);
-                                       bzero(val + 4, 4);
+                                       memcpy(val, options + i + 2, 4);
+                                       memset(val + 4, 0, 4);
                                        dccp_add_option(dp, DCCP_OPT_TIMESTAMP_ECHO, val, 8);
                                break;
                                
@@ -2502,10 +2502,10 @@
                                        DCCP_DEBUG((LOG_INFO, "\n"));
 
                                        /*
-                                               bcopy(options + i + 2, &(dp->timestamp_echo), 4);
-                                               bcopy(options + i + 6, &(dp->timestamp_elapsed), 4);
-                                               ACK_DEBUG((LOG_INFO, "DATA; echo = %u , elapsed = %u\n",
-                                                  dp->timestamp_echo, dp->timestamp_elapsed));
+                                       memcpy(&(dp->timestamp_echo), options + i + 2, 4);
+                                       memcpy(&(dp->timestamp_elapsed), options + i + 6, 4);
+                                       ACK_DEBUG((LOG_INFO, "DATA; echo = %u , elapsed = %u\n",
+                                           dp->timestamp_echo, dp->timestamp_elapsed));
                                        */
                                
                                break;
@@ -2653,7 +2653,7 @@
                        
                case DCCP_FEATURE_ACKRATIO:
                        if (opt == DCCP_OPT_CHANGE_R) {
-                               bcopy(val , &(dp->ack_ratio), 1);
+                               memcpy(&(dp->ack_ratio), val, 1);
                                ACK_DEBUG((LOG_INFO, "Feature: Change Ack Ratio to %u\n", dp->ack_ratio));
                        }
                        break;
@@ -2748,12 +2748,12 @@
                        vaddr_t inp_ppcb;
                        xd.xd_len = sizeof xd;
                        /* XXX should avoid extra copy */
-                       bcopy(inp, &xd.xd_inp, sizeof *inp);
+                       memcpy(&xd.xd_inp, inp, sizeof *inp);
                        inp_ppcb = inp->inp_ppcb;
                        if (inp_ppcb != NULL)
-                               bcopy(inp_ppcb, &xd.xd_dp, sizeof xd.xd_dp);
+                               memcpy(&xd.xd_dp, inp_ppcb, sizeof xd.xd_dp);
                        else
-                               bzero((char *) &xd.xd_dp, sizeof xd.xd_dp);
+                               memset((char *) &xd.xd_dp, 0, sizeof xd.xd_dp);
                        if (inp->inp_socket)
                                 sotoxsocket(inp->inp_socket, &xd.xd_socket);
                        error = SYSCTL_OUT(req, &xd, sizeof xd);



Home | Main Index | Thread Index | Old Index