Compare commits

...

2 Commits

Author SHA1 Message Date
Mark Andrews
bd89095d8c silence 'may be used uninitialized in' 2018-08-08 17:35:38 +10:00
Mark Andrews
666a32b89b provide full distributio with random 2018-08-08 17:24:04 +10:00

View File

@@ -400,6 +400,7 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
}
if ((shuffle || sort)) {
div_t q = { 0, 0 };
/*
* First we get handles to all of the rdata.
*/
@@ -417,9 +418,8 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
INSIST(i == count);
unsigned int j;
isc_uint32_t seed;
if (ISC_LIKELY(want_random)) {
seed = isc_random32();
q.quot = isc_random32() & 0x7fffffff;
j = 0;
}
@@ -433,7 +433,11 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
for (i = 0; i < count; i++) {
if (ISC_LIKELY(want_random)) {
swap_rdata(in, j, j + seed % (count - j));
q = div(q.quot, count - j);
swap_rdata(in, j, j + q.rem);
if (ISC_UNLIKELY(q.quot == 0)) {
q.quot = isc_random32() & 0x7fffffff;
}
}
out[i].key = (sort) ?