summaryrefslogtreecommitdiff
path: root/bisect.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-11 17:33:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-11 17:33:36 (GMT)
commit1ebe6a825a1ff12e12905e28265aa30e269700d6 (patch)
tree0ad33ffa41525b67198a5d756a8e5beedee2ea73 /bisect.c
parentf28763d7561f66c0c6ff9b5d48146a0f923781d3 (diff)
parent2e3dfb216991974b60fdb1933eb3331e03383e61 (diff)
downloadgit-1ebe6a825a1ff12e12905e28265aa30e269700d6.zip
git-1ebe6a825a1ff12e12905e28265aa30e269700d6.tar.gz
git-1ebe6a825a1ff12e12905e28265aa30e269700d6.tar.bz2
Merge branch 'jk/name-decoration-alloc'
The API to allocate the structure to keep track of commit decoration was cumbersome to use, inviting lazy code to overallocate memory. * jk/name-decoration-alloc: log-tree: use FLEX_ARRAY in name_decoration log-tree: make name_decoration hash static log-tree: make add_name_decoration a public function
Diffstat (limited to 'bisect.c')
-rw-r--r--bisect.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bisect.c b/bisect.c
index d6e851d..df09cbc 100644
--- a/bisect.c
+++ b/bisect.c
@@ -215,11 +215,12 @@ static struct commit_list *best_bisection_sorted(struct commit_list *list, int n
}
qsort(array, cnt, sizeof(*array), compare_commit_dist);
for (p = list, i = 0; i < cnt; i++) {
- struct name_decoration *r = xmalloc(sizeof(*r) + 100);
+ char buf[100]; /* enough for dist=%d */
struct object *obj = &(array[i].commit->object);
- sprintf(r->name, "dist=%d", array[i].distance);
- r->next = add_decoration(&name_decoration, obj, r);
+ snprintf(buf, sizeof(buf), "dist=%d", array[i].distance);
+ add_name_decoration(DECORATION_NONE, buf, obj);
+
p->item = array[i].commit;
p = p->next;
}