Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/wscons use sizeof(*var) instead of sizeof(type)



details:   https://anonhg.NetBSD.org/src/rev/d5648d4bd14d
branches:  trunk
changeset: 357272:d5648d4bd14d
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Nov 04 01:52:09 2017 +0000

description:
use sizeof(*var) instead of sizeof(type)

diffstat:

 sys/dev/wscons/wsdisplay_compat_usl.c |  10 +++++-----
 sys/dev/wscons/wsdisplay_glyphcache.c |   6 ++++--
 2 files changed, 9 insertions(+), 7 deletions(-)

diffs (65 lines):

diff -r 54cc544987e1 -r d5648d4bd14d sys/dev/wscons/wsdisplay_compat_usl.c
--- a/sys/dev/wscons/wsdisplay_compat_usl.c     Sat Nov 04 01:50:48 2017 +0000
+++ b/sys/dev/wscons/wsdisplay_compat_usl.c     Sat Nov 04 01:52:09 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_compat_usl.c,v 1.50 2017/11/03 13:34:56 maya Exp $ */
+/* $NetBSD: wsdisplay_compat_usl.c,v 1.51 2017/11/04 01:52:09 christos Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.50 2017/11/03 13:34:56 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.51 2017/11/04 01:52:09 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_freebsd.h"
@@ -101,7 +101,7 @@
        struct usl_syncdata *sd;
        int res;
 
-       sd = kmem_alloc(sizeof(struct usl_syncdata), KM_SLEEP);
+       sd = kmem_alloc(sizeof(*sd), KM_SLEEP);
 
        sd->s_scr = scr;
        sd->s_proc = p;
@@ -116,7 +116,7 @@
        callout_setfunc(&sd->s_detach_ch, usl_detachtimeout, sd);
        res = wsscreen_attach_sync(scr, &usl_syncops, sd);
        if (res) {
-               kmem_free(sd, sizeof(struct usl_syncdata));
+               kmem_free(sd, sizeof(*sd));
                return (res);
        }
        *sdp = sd;
@@ -135,7 +135,7 @@
                (*sd->s_callback)(sd->s_cbarg, ENXIO, 0);
        }
        wsscreen_detach_sync(sd->s_scr);
-       kmem_free(sd, sizeof(struct usl_syncdata));
+       kmem_free(sd, sizeof(*sd));
 }
 
 static int
diff -r 54cc544987e1 -r d5648d4bd14d sys/dev/wscons/wsdisplay_glyphcache.c
--- a/sys/dev/wscons/wsdisplay_glyphcache.c     Sat Nov 04 01:50:48 2017 +0000
+++ b/sys/dev/wscons/wsdisplay_glyphcache.c     Sat Nov 04 01:52:09 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wsdisplay_glyphcache.c,v 1.9 2017/06/02 19:30:10 macallan Exp $        */
+/*     $NetBSD: wsdisplay_glyphcache.c,v 1.10 2017/11/04 01:52:09 christos Exp $       */
 
 /*
  * Copyright (c) 2012 Michael Lorenz
@@ -74,7 +74,9 @@
        gc->gc_lines = lines;
        gc->gc_buckets = NULL;
        gc->gc_numbuckets = 0;
-       gc->gc_buckets = kmem_alloc(sizeof(gc_bucket) * NBUCKETS, KM_SLEEP);
+       // XXX: Never free?
+       gc->gc_buckets = kmem_alloc(sizeof(*gc->gc_buckets) * NBUCKETS,
+           KM_SLEEP);
        gc->gc_nbuckets = NBUCKETS;
        return glyphcache_reconfig(gc, cellwidth, cellheight, attr);
 



Home | Main Index | Thread Index | Old Index