Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Replace offsetof(pcq_t, pcq_items[nitems]) with siz...



details:   https://anonhg.NetBSD.org/src/rev/20ee4765718d
branches:  trunk
changeset: 773346:20ee4765718d
user:      alnsn <alnsn%NetBSD.org@localhost>
date:      Tue Jan 31 19:11:37 2012 +0000

description:
Replace offsetof(pcq_t, pcq_items[nitems]) with sizeof(pcq_t) + sizeof(void *[nitems]).

diffstat:

 sys/kern/subr_pcq.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 833b5e18c4d6 -r 20ee4765718d sys/kern/subr_pcq.c
--- a/sys/kern/subr_pcq.c       Tue Jan 31 19:02:49 2012 +0000
+++ b/sys/kern/subr_pcq.c       Tue Jan 31 19:11:37 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pcq.c,v 1.4 2012/01/22 02:55:47 rmind Exp $       */
+/*     $NetBSD: subr_pcq.c,v 1.5 2012/01/31 19:11:37 alnsn Exp $       */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pcq.c,v 1.4 2012/01/22 02:55:47 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pcq.c,v 1.5 2012/01/31 19:11:37 alnsn Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -199,7 +199,7 @@
 
        KASSERT(nitems > 0 || nitems <= 0xffff);
 
-       pcq = kmem_zalloc(offsetof(pcq_t, pcq_items[nitems]), kmflags);
+       pcq = kmem_zalloc(sizeof(pcq_t) + sizeof(void *[nitems]), kmflags);
        if (pcq == NULL) {
                return NULL;
        }



Home | Main Index | Thread Index | Old Index