summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-07-12 15:18:23 -0700
committerJunio C Hamano <gitster@pobox.com>2017-07-12 15:18:23 -0700
commitf056cde60e7b095edf1530554a8c9528bd8b374b (patch)
tree1507f5729cc2a2718b59712b0aac3a7350c2144f /builtin
parent768d0fe0dadbffe722fa4b80b2180a4fcaf1c854 (diff)
parent42c78a216e751cfa2720c8276c9e9f2b81640e6b (diff)
downloadgit-f056cde60e7b095edf1530554a8c9528bd8b374b.tar.gz
Merge branch 'rs/use-div-round-up'
Code cleanup. * rs/use-div-round-up: use DIV_ROUND_UP
Diffstat (limited to 'builtin')
-rw-r--r--builtin/gc.c2
-rw-r--r--builtin/grep.c2
-rw-r--r--builtin/log.c2
-rw-r--r--builtin/receive-pack.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index bd91f136fe..2ba50a2873 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -149,7 +149,7 @@ static int too_many_loose_objects(void)
if (!dir)
return 0;
- auto_threshold = (gc_auto_threshold + 255) / 256;
+ auto_threshold = DIV_ROUND_UP(gc_auto_threshold, 256);
while ((ent = readdir(dir)) != NULL) {
if (strspn(ent->d_name, "0123456789abcdef") != 38 ||
ent->d_name[38] != '\0')
diff --git a/builtin/grep.c b/builtin/grep.c
index fa351c49f4..0d6e669732 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -543,7 +543,7 @@ static void compile_submodule_options(const struct grep_opt *opt,
* submodule process has its own thread pool.
*/
argv_array_pushf(&submodule_options, "--threads=%d",
- (num_threads + 1) / 2);
+ DIV_ROUND_UP(num_threads, 2));
/* Add Pathspecs */
argv_array_push(&submodule_options, "--");
diff --git a/builtin/log.c b/builtin/log.c
index 8ca1de9894..c6362cf92e 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1308,7 +1308,7 @@ static struct commit *get_base_commit(const char *base_commit,
if (rev_nr % 2)
rev[i] = rev[2 * i];
- rev_nr = (rev_nr + 1) / 2;
+ rev_nr = DIV_ROUND_UP(rev_nr, 2);
}
if (!in_merge_bases(base, rev[0]))
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 71c0c768db..cabdc55e09 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1806,7 +1806,7 @@ static const char *unpack_with_sideband(struct shallow_info *si)
static void prepare_shallow_update(struct command *commands,
struct shallow_info *si)
{
- int i, j, k, bitmap_size = (si->ref->nr + 31) / 32;
+ int i, j, k, bitmap_size = DIV_ROUND_UP(si->ref->nr, 32);
ALLOC_ARRAY(si->used_shallow, si->shallow->nr);
assign_shallow_commits_to_refs(si, si->used_shallow, NULL);