mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
hash: minor touchups
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.
This commit is contained in:
parent
8973190735
commit
19896423f7
1
.gitignore
vendored
1
.gitignore
vendored
@ -78,6 +78,7 @@
|
|||||||
/tests/openvzutilstest
|
/tests/openvzutilstest
|
||||||
/tests/qemuxmlnstest
|
/tests/qemuxmlnstest
|
||||||
/tests/shunloadtest
|
/tests/shunloadtest
|
||||||
|
/tests/virhashtest
|
||||||
/update.log
|
/update.log
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* cgroup.c: Tools for managing cgroups
|
* cgroup.c: Tools for managing cgroups
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
* Copyright (C) 2010-2012 Red Hat, Inc.
|
||||||
* Copyright IBM Corp. 2008
|
* Copyright IBM Corp. 2008
|
||||||
*
|
*
|
||||||
* See COPYING.LIB for the License of this software
|
* See COPYING.LIB for the License of this software
|
||||||
|
@ -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
|
* Reference: Your favorite introductory book on algorithms
|
||||||
*
|
*
|
||||||
|
@ -46,7 +46,11 @@ int virRandomInitialize(uint32_t seed)
|
|||||||
return 0;
|
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:
|
* virRandomBits:
|
||||||
* @nbits: Number of bits of randommess required
|
* @nbits: Number of bits of randommess required
|
||||||
*
|
*
|
||||||
@ -61,10 +65,6 @@ uint64_t virRandomBits(int nbits)
|
|||||||
uint64_t ret = 0;
|
uint64_t ret = 0;
|
||||||
int32_t bits;
|
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);
|
virMutexLock(&randomLock);
|
||||||
|
|
||||||
while (nbits > bits_per_iter) {
|
while (nbits > bits_per_iter) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user