Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Move entropy_count into the scope where it is used.



details:   https://anonhg.NetBSD.org/src/rev/42d359c5e8b9
branches:  trunk
changeset: 343622:42d359c5e8b9
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Feb 17 01:23:32 2016 +0000

description:
Move entropy_count into the scope where it is used.

Omit now-unused definition.

XXX This code probably shouldn't be under DIAGNOSTIC...  It is
significantly more than just an assertion.

diffstat:

 sys/kern/kern_rndq.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (44 lines):

diff -r 5bb8953d597f -r 42d359c5e8b9 sys/kern/kern_rndq.c
--- a/sys/kern/kern_rndq.c      Wed Feb 17 01:09:49 2016 +0000
+++ b/sys/kern/kern_rndq.c      Wed Feb 17 01:23:32 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_rndq.c,v 1.79 2016/02/17 01:09:49 riastradh Exp $ */
+/*     $NetBSD: kern_rndq.c,v 1.80 2016/02/17 01:23:32 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.79 2016/02/17 01:09:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.80 2016/02/17 01:23:32 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -1161,7 +1161,6 @@
 rnd_extract_data(void *p, uint32_t len, uint32_t flags)
 {
        static int timed_in;
-       int entropy_count;
        uint32_t retval;
 
        mutex_spin_enter(&rnd_global.lock);
@@ -1184,7 +1183,8 @@
 
 #ifdef DIAGNOSTIC
        while (!rnd_tested) {
-               entropy_count = rndpool_get_entropy_count(&rnd_global.pool);
+               int entropy_count =
+                   rndpool_get_entropy_count(&rnd_global.pool);
                rnd_printf_verbose("rnd: starting statistical RNG test,"
                    " entropy = %d.\n",
                    entropy_count);
@@ -1224,7 +1224,6 @@
                rnd_tested++;
        }
 #endif
-       entropy_count = rndpool_get_entropy_count(&rnd_global.pool);
        retval = rndpool_extract_data(&rnd_global.pool, p, len, flags);
        mutex_spin_exit(&rnd_global.lock);
 



Home | Main Index | Thread Index | Old Index