Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Compute the pointer earlier, not in the return stat...



details:   https://anonhg.NetBSD.org/src/rev/4dca42cd8b1c
branches:  trunk
changeset: 365539:4dca42cd8b1c
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Aug 20 11:46:44 2018 +0000

description:
Compute the pointer earlier, not in the return statement. No functional
change.

diffstat:

 sys/kern/kern_malloc.c |  7 ++++---
 sys/kern/subr_kmem.c   |  7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diffs (58 lines):

diff -r 7cbdf3fc4114 -r 4dca42cd8b1c sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c    Mon Aug 20 11:35:28 2018 +0000
+++ b/sys/kern/kern_malloc.c    Mon Aug 20 11:46:44 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_malloc.c,v 1.146 2017/07/28 12:28:48 martin Exp $ */
+/*     $NetBSD: kern_malloc.c,v 1.147 2018/08/20 11:46:44 maxv Exp $   */
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.146 2017/07/28 12:28:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.147 2018/08/20 11:46:44 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -124,8 +124,9 @@
        }
        mh = (void *)((char *)p + hdroffset);
        mh->mh_size = allocsize - hdroffset;
+       mh++;
 
-       return mh + 1;
+       return mh;
 }
 
 void
diff -r 7cbdf3fc4114 -r 4dca42cd8b1c sys/kern/subr_kmem.c
--- a/sys/kern/subr_kmem.c      Mon Aug 20 11:35:28 2018 +0000
+++ b/sys/kern/subr_kmem.c      Mon Aug 20 11:46:44 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_kmem.c,v 1.67 2018/08/20 11:35:28 maxv Exp $      */
+/*     $NetBSD: subr_kmem.c,v 1.68 2018/08/20 11:46:44 maxv Exp $      */
 
 /*-
  * Copyright (c) 2009-2015 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.67 2018/08/20 11:35:28 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.68 2018/08/20 11:46:44 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kmem.h"
@@ -265,8 +265,9 @@
        if (__predict_true(p != NULL)) {
                FREECHECK_OUT(&kmem_freecheck, p);
                kmem_size_set(p, requested_size);
+               p += SIZE_SIZE;
 
-               return p + SIZE_SIZE;
+               return p;
        }
        return p;
 }



Home | Main Index | Thread Index | Old Index