aboutsummaryrefslogtreecommitdiff
path: root/builtin-show-branch.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-06-17 18:26:18 -0700
committerJunio C Hamano <junkio@cox.net>2006-06-17 18:49:45 -0700
commitd3ff6f55012c939740ce0982b24aeb6fba3c6e4f (patch)
tree3784f041b9ceb25a8092b85f1d86119da7bc5a45 /builtin-show-branch.c
parent885a86abe2e9f7b96a4e2012183c6751635840aa (diff)
downloadgit-d3ff6f55012c939740ce0982b24aeb6fba3c6e4f.tar.gz
git-d3ff6f55012c939740ce0982b24aeb6fba3c6e4f.tar.xz
Move "void *util" from "struct object" into "struct commit"
Every single user actually wanted this only for commit objects, and we have no reason to waste space on it for other object types. So just move the structure member from the low-level "struct object" into the "struct commit". This leaves the commit object the same size, and removes one unnecessary pointer from all other object allocations. This shrinks memory usage (still at a fairly hefty half-gig, admittedly) of "git-rev-list --all --objects" on the mozilla repo by another 5% in my tests. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-show-branch.c')
-rw-r--r--builtin-show-branch.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index cf9c071a5..09d822786 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -51,9 +51,9 @@ struct commit_name {
static void name_commit(struct commit *commit, const char *head_name, int nth)
{
struct commit_name *name;
- if (!commit->object.util)
- commit->object.util = xmalloc(sizeof(struct commit_name));
- name = commit->object.util;
+ if (!commit->util)
+ commit->util = xmalloc(sizeof(struct commit_name));
+ name = commit->util;
name->head_name = head_name;
name->generation = nth;
}
@@ -65,8 +65,8 @@ static void name_commit(struct commit *commit, const char *head_name, int nth)
*/
static void name_parent(struct commit *commit, struct commit *parent)
{
- struct commit_name *commit_name = commit->object.util;
- struct commit_name *parent_name = parent->object.util;
+ struct commit_name *commit_name = commit->util;
+ struct commit_name *parent_name = parent->util;
if (!commit_name)
return;
if (!parent_name ||
@@ -80,12 +80,12 @@ static int name_first_parent_chain(struct commit *c)
int i = 0;
while (c) {
struct commit *p;
- if (!c->object.util)
+ if (!c->util)
break;
if (!c->parents)
break;
p = c->parents->item;
- if (!p->object.util) {
+ if (!p->util) {
name_parent(c, p);
i++;
}
@@ -106,7 +106,7 @@ static void name_commits(struct commit_list *list,
/* First give names to the given heads */
for (cl = list; cl; cl = cl->next) {
c = cl->item;
- if (c->object.util)
+ if (c->util)
continue;
for (i = 0; i < num_rev; i++) {
if (rev[i] == c) {
@@ -132,9 +132,9 @@ static void name_commits(struct commit_list *list,
struct commit_name *n;
int nth;
c = cl->item;
- if (!c->object.util)
+ if (!c->util)
continue;
- n = c->object.util;
+ n = c->util;
parents = c->parents;
nth = 0;
while (parents) {
@@ -142,7 +142,7 @@ static void name_commits(struct commit_list *list,
char newname[1000], *en;
parents = parents->next;
nth++;
- if (p->object.util)
+ if (p->util)
continue;
en = newname;
switch (n->generation) {
@@ -257,7 +257,7 @@ static void join_revs(struct commit_list **list_p,
static void show_one_commit(struct commit *commit, int no_name)
{
char pretty[256], *cp;
- struct commit_name *name = commit->object.util;
+ struct commit_name *name = commit->util;
if (commit->object.parsed)
pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0,
pretty, sizeof(pretty), 0, NULL, NULL);