On 09/10/2015 05:09 PM, John Snow wrote: > Fix the pattern generation to actually be interesting, > and make sure all buffers in the ahci-test actually use it. > > Signed-off-by: John Snow <js...@redhat.com> > --- > tests/ahci-test.c | 23 ++++++----------------- > 1 file changed, 6 insertions(+), 17 deletions(-) > > diff --git a/tests/ahci-test.c b/tests/ahci-test.c > index 87d7691..b1a785c 100644 > --- a/tests/ahci-test.c > +++ b/tests/ahci-test.c > @@ -80,9 +80,9 @@ static void generate_pattern(void *buffer, size_t len, > size_t cycle_len) > > /* Write an indicative pattern that varies and is unique per-cycle */ > p = rand() % 256; > - for (i = j = 0; i < len; i++, j++) { > - tx[i] = p; > - if (j % cycle_len == 0) { > + for (i = 0; i < len; i++) { > + tx[i] = p++ % 256; > + if (i % cycle_len == 0) { > p = rand() % 256;
I'd drop the pointless %256, since the compiler already automatically truncates int to char when assigning to a char variable. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature