Source-Changes-HG archive

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

src: Reorder a few instructions to clarify. Replace two bcopy by...



details:   https://anonhg.NetBSD.org/src/rev/7ef118595ff8
branches:  trunk
changeset: 318131:7ef118595ff8
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Apr 13 08:12:51 2018 +0000
description:
Reorder a few instructions to clarify. Replace two bcopy by memcpy.

diffstat:

 sys/netinet/ip_output.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r 1b1487815d03 -r 7ef118595ff8 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Fri Apr 13 08:01:23 2018 +0000
+++ b/sys/netinet/ip_output.c   Fri Apr 13 08:12:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.299 2018/03/30 22:54:37 maya Exp $     */
+/*     $NetBSD: ip_output.c,v 1.300 2018/04/13 08:12:51 maxv Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.299 2018/03/30 22:54:37 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.300 2018/04/13 08:12:51 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1031,10 +1031,10 @@
                m->m_len -= sizeof(struct ip);
                m->m_data += sizeof(struct ip);
                n->m_next = m;
+               n->m_len = optlen + sizeof(struct ip);
+               n->m_data += max_linkhdr;
+               memcpy(mtod(n, void *), ip, sizeof(struct ip));
                m = n;
-               m->m_len = optlen + sizeof(struct ip);
-               m->m_data += max_linkhdr;
-               bcopy((void *)ip, mtod(m, void *), sizeof(struct ip));
        } else {
                m->m_data -= optlen;
                m->m_len += optlen;
@@ -1042,7 +1042,7 @@
        }
        m->m_pkthdr.len += optlen;
        ip = mtod(m, struct ip *);
-       bcopy((void *)p->ipopt_list, (void *)(ip + 1), (unsigned)optlen);
+       memcpy(ip + 1, p->ipopt_list, optlen);
        *phlen = sizeof(struct ip) + optlen;
        ip->ip_len = htons(ntohs(ip->ip_len) + optlen);
        return m;



Home | Main Index | Thread Index | Old Index