]> xenbits.xensource.com Git - libvirt.git/commitdiff
hash: minor touchups
authorEric Blake <eblake@redhat.com>
Wed, 25 Jan 2012 16:38:37 +0000 (16:38 +0000)
committerEric Blake <eblake@redhat.com>
Thu, 26 Jan 2012 22:27:10 +0000 (15:27 -0700)
On RHEL5, I got:
util/virrandom.c:66: warning: nested extern declaration of '_gl_verify_function66' [-Wnested-externs]

The fix is to hoist the verify earlier.  Also some other hodge-podge
fixes I noticed while reviewing Dan's recent series.

* .gitignore: Ignore new test.
* src/util/cgroup.c: Bump copyright year.
* src/util/virhash.c: Fix typo in description.
* src/util/virrandom.c (virRandomBits): Mark doc comment, and
hoist assert to silence older gcc.

.gitignore
src/util/cgroup.c
src/util/virhash.c
src/util/virrandom.c

index 61a9a3831f223e36e9ec8697ec285f97b11ac9ef..2533fced83fd93539e980b55277f0cedace8a6a1 100644 (file)
@@ -78,6 +78,7 @@
 /tests/openvzutilstest
 /tests/qemuxmlnstest
 /tests/shunloadtest
+/tests/virhashtest
 /update.log
 Makefile
 Makefile.in
index 3f092ab1a48deea205c632d01e42a94a59c9a349..15b870d842cf2f4d41877009b6ef81022d0309a8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * cgroup.c: Tools for managing cgroups
  *
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-2012 Red Hat, Inc.
  * Copyright IBM Corp. 2008
  *
  * See COPYING.LIB for the License of this software
index efaa286b35d765a245c040dcfe1bc1e5693cb936..6dec684c5be1d436607835e388860739acb144cb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * virhash.c: chained hash tables for domain and domain/connection deallocatiosn
+ * virhash.c: chained hash tables
  *
  * Reference: Your favorite introductory book on algorithms
  *
index 0af94d5da8b5540a254a8963bf4849cea57d7797..ec0cf0336aafd9d39dc66a4f8f7e7ee8711b4884 100644 (file)
@@ -46,7 +46,11 @@ int virRandomInitialize(uint32_t seed)
     return 0;
 }
 
-/*
+/* The algorithm of virRandomBits requires that RAND_MAX == 2^n-1 for
+ * some n; gnulib's random_r meets this property. */
+verify(((RAND_MAX + 1U) & RAND_MAX) == 0);
+
+/**
  * virRandomBits:
  * @nbits: Number of bits of randommess required
  *
@@ -61,10 +65,6 @@ uint64_t virRandomBits(int nbits)
     uint64_t ret = 0;
     int32_t bits;
 
-    /* This algorithm requires that RAND_MAX == 2^n-1 for some n;
-       gnulib's random_r meets this property. */
-    verify(((RAND_MAX + 1U) & RAND_MAX) == 0);
-
     virMutexLock(&randomLock);
 
     while (nbits > bits_per_iter) {