1
0
mirror of https://github.com/git/git synced 2024-07-07 19:39:27 +00:00

process_{tree,blob}: Remove useless xstrdup calls

On Wed, 8 Apr 2009, Björn Steinbrink wrote:
>
> The name of the processed object was duplicated for passing it to
> add_object(), but that already calls path_name, which allocates a new
> string anyway. So the memory allocated by the xstrdup calls just went
> nowhere, leaking memory.

Ack, ack.

There's another easy 5% or so for the built-in object walker: once we've
created the hash from the name, the name isn't interesting any more, and
so something trivial like this can help a bit.

Does it matter? Probably not on its own. But a few more memory saving
tricks and it might all make a difference.

		Linus

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Linus Torvalds 2009-04-10 15:20:18 -07:00 committed by Junio C Hamano
parent de551d472e
commit 213152688c

View File

@ -1861,6 +1861,8 @@ static void show_object(struct object_array_entry *p)
add_preferred_base_object(p->name);
add_object_entry(p->item->sha1, p->item->type, p->name, 0);
p->item->flags |= OBJECT_ADDED;
free((char *)p->name);
p->name = NULL;
}
static void show_edge(struct commit *commit)