Source-Changes-HG archive

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

[src/trunk]: src/sys Change the first argument of m_copydata() to "const stru...



details:   https://anonhg.NetBSD.org/src/rev/73a2886ebc70
branches:  trunk
changeset: 581530:73a2886ebc70
user:      tron <tron%NetBSD.org@localhost>
date:      Thu Jun 02 10:34:59 2005 +0000

description:
Change the first argument of m_copydata() to "const struct mbuf *" (which
doesn't require any implementation changes). This will allow us to get
rid off a lot of nasty type casts.

diffstat:

 sys/kern/uipc_mbuf.c |  14 +++++++-------
 sys/sys/mbuf.h       |   4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diffs (53 lines):

diff -r b6b0d66bcd09 -r 73a2886ebc70 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Thu Jun 02 10:29:04 2005 +0000
+++ b/sys/kern/uipc_mbuf.c      Thu Jun 02 10:34:59 2005 +0000
@@ -668,24 +668,24 @@
  * continuing for "len" bytes, into the indicated buffer.
  */
 void
-m_copydata(struct mbuf *m, int off, int len, void *vp)
+m_copydata(const struct mbuf *m, int off, int len, void *vp)
 {
-       unsigned count;
-       char *cp = vp;
+       unsigned        count;
+       caddr_t         *cp = vp;
 
        if (off < 0 || len < 0)
                panic("m_copydata: off %d, len %d", off, len);
        while (off > 0) {
-               if (m == 0)
-                       panic("m_copydata: m == 0, off %d", off);
+               if (m == NULL)
+                       panic("m_copydata: m == NULL, off %d", off);
                if (off < m->m_len)
                        break;
                off -= m->m_len;
                m = m->m_next;
        }
        while (len > 0) {
-               if (m == 0)
-                       panic("m_copydata: m == 0, len %d", len);
+               if (m == NULL)
+                       panic("m_copydata: m == NULL, len %d", len);
                count = min(m->m_len - off, len);
                memcpy(cp, mtod(m, caddr_t) + off, count);
                len -= count;
diff -r b6b0d66bcd09 -r 73a2886ebc70 sys/sys/mbuf.h
--- a/sys/sys/mbuf.h    Thu Jun 02 10:29:04 2005 +0000
+++ b/sys/sys/mbuf.h    Thu Jun 02 10:34:59 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbuf.h,v 1.108 2005/06/01 18:03:50 drochner Exp $      */
+/*     $NetBSD: mbuf.h,v 1.109 2005/06/02 10:34:59 tron Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2001 The NetBSD Foundation, Inc.
@@ -833,7 +833,7 @@
 void   m_copyback(struct mbuf *, int, int, const void *);
 struct mbuf *m_copyback_cow(struct mbuf *, int, int, const void *, int);
 int    m_makewritable(struct mbuf **, int, int, int);
-void   m_copydata(struct mbuf *, int, int, void *);
+void   m_copydata(const struct mbuf *, int, int, void *);
 void   m_freem(struct mbuf *);
 void   m_reclaim(void *, int);
 void   mbinit(void);



Home | Main Index | Thread Index | Old Index