]> git.ipfire.org Git - thirdparty/git.git/commit
builtin-shortlog.c: use string_list_append(), and don't strdup unnecessarily
authorAdeodato Simó <dato@net.com.org.es>
Tue, 30 Dec 2008 21:01:44 +0000 (22:01 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Jan 2009 11:31:56 +0000 (03:31 -0800)
commitfe73fc1abe785a423fcc51b753d57ffa1485edab
tree9712bbeb0ffe51d688861553f36645c5ff372907
parent8104ebfe8276657ee803cca7eb8665a78cf3ef83
builtin-shortlog.c: use string_list_append(), and don't strdup unnecessarily

Make insert_one_record() use string_list_append(), instead of duplicating
its code. Because of this, do not free the "util" member when clearing the
"onelines" string lists: with the new code path it is not initialized to
any value (was being initialized to NULL previously).

Also, avoid unnecessary strdup() calls when inserting names in log->list.
This list always has "strdup_strings" activated, hence strdup'ing namebuf is
unnecessary. This change also removes a latent memory leak in the old code.

NB: The duplicated code mentioned above predated the appearance of
string_list_append().

Signed-off-by: Adeodato Simó <dato@net.com.org.es>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-shortlog.c