From: Junio C Hamano Date: Wed, 12 Jul 2017 22:18:23 +0000 (-0700) Subject: Merge branch 'rs/use-div-round-up' X-Git-Tag: v2.14.0-rc0~9 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f056cde60e7b095edf1530554a8c9528bd8b374b Merge branch 'rs/use-div-round-up' Code cleanup. * rs/use-div-round-up: use DIV_ROUND_UP --- f056cde60e7b095edf1530554a8c9528bd8b374b diff --cc shallow.c index ef7ca78993,1aee070c4d..54359d5490 --- a/shallow.c +++ b/shallow.c @@@ -471,9 -471,9 +471,9 @@@ static void paint_down(struct paint_inf { unsigned int i, nr; struct commit_list *head = NULL; - int bitmap_nr = (info->nr_bits + 31) / 32; + int bitmap_nr = DIV_ROUND_UP(info->nr_bits, 32); size_t bitmap_size = st_mult(sizeof(uint32_t), bitmap_nr); - struct commit *c = lookup_commit_reference_gently(sha1, 1); + struct commit *c = lookup_commit_reference_gently(oid, 1); uint32_t *tmp; /* to be freed before return */ uint32_t *bitmap; @@@ -608,13 -608,13 +608,13 @@@ void assign_shallow_commits_to_refs(str } for (i = 0; i < ref->nr; i++) - paint_down(&pi, ref->oid[i].hash, i); + paint_down(&pi, ref->oid + i, i); if (used) { - int bitmap_size = ((pi.nr_bits + 31) / 32) * sizeof(uint32_t); + int bitmap_size = DIV_ROUND_UP(pi.nr_bits, 32) * sizeof(uint32_t); memset(used, 0, sizeof(*used) * info->shallow->nr); for (i = 0; i < nr_shallow; i++) { - const struct commit *c = lookup_commit(oid[shallow[i]].hash); + const struct commit *c = lookup_commit(&oid[shallow[i]]); uint32_t **map = ref_bitmap_at(&pi.ref_bitmap, c); if (*map) used[shallow[i]] = xmemdupz(*map, bitmap_size);