Jeff King <peff@xxxxxxxx> writes: >> - for (i = 0; i < m->num_objects - 1; i++) { >> + for (i = 0; i + 1 < m->num_objects; i++) { >> struct object_id oid1, oid2; >> >> nth_midxed_object_oid(&oid1, m, i); > [...] nth_midxed_object_oid(&oid2, m, i + 1); > > Perhaps it would be simpler as: > > for (i = 1; i < m->num_objects; i++) { > ... > nth_midxed_object_oid(&oid1, m, i - 1); > nth_midxed_object_oid(&oid2, m, i); > ... > } "Count up while i+1 is smaller than..." looked extremely unnatural and it was hard to grok, at least to me. This for (i = 0; i < m->num_objects - 1; i++) { might have been more palatable, but yours is much better. > Though I almost wonder if we should be catching "m->num_objects == 0" > early and declaring the midx to be bogus (it's not _technically_ wrong, > but I'd have to suspect a bug in anything that generated a 0-object midx > file). That, too ;-)