Merge branch 'rs/use-div-round-up'
authorJunio C Hamano <gitster@pobox.com>
Wed, 12 Jul 2017 22:18:23 +0000 (15:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Jul 2017 22:18:23 +0000 (15:18 -0700)
Code cleanup.

* rs/use-div-round-up:
use DIV_ROUND_UP

1  2 
builtin/gc.c
builtin/grep.c
builtin/log.c
builtin/receive-pack.c
diff.c
imap-send.c
sha1_name.c
shallow.c
diff --cc builtin/gc.c
Simple merge
diff --cc builtin/grep.c
Simple merge
diff --cc builtin/log.c
Simple merge
Simple merge
diff --cc diff.c
Simple merge
diff --cc imap-send.c
Simple merge
diff --cc sha1_name.c
Simple merge
diff --cc shallow.c
index ef7ca78993df20082c858a7d2b8c7094fcbd1590,1aee070c4da64f7f03473bc812c6c1e942944a37..54359d549075b5cfe1670ca979ff3cf5eeedc9d1
+++ 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);