diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-06-14 08:46:13 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-14 08:46:14 -0700 |
commit | ede63a195c53d31207d694258bd8bc740dbc87a7 (patch) | |
tree | e2b1eee737f1b7c3af9590f6b8b2a09962ea7537 /submodule.c | |
parent | b27a79d16b21be064c0ac3634928a91e3eee5c01 (diff) | |
parent | 4f78c24c63bf0b035afc02372727a3b5897d9835 (diff) | |
download | git-ede63a195c53d31207d694258bd8bc740dbc87a7.tar.gz |
Merge branch 'mh/reflife'
Define memory ownership and lifetime rules for what for-each-ref
feeds to its callbacks (in short, "you do not own it, so make a
copy if you want to keep it").
* mh/reflife: (25 commits)
refs: document the lifetime of the args passed to each_ref_fn
register_ref(): make a copy of the bad reference SHA-1
exclude_existing(): set existing_refs.strdup_strings
string_list_add_refs_by_glob(): add a comment about memory management
string_list_add_one_ref(): rename first parameter to "refname"
show_head_ref(): rename first parameter to "refname"
show_head_ref(): do not shadow name of argument
add_existing(): do not retain a reference to sha1
do_fetch(): clean up existing_refs before exiting
do_fetch(): reduce scope of peer_item
object_array_entry: fix memory handling of the name field
find_first_merges(): remove unnecessary code
find_first_merges(): initialize merges variable using initializer
fsck: don't put a void*-shaped peg in a char*-shaped hole
object_array_remove_duplicates(): rewrite to reduce copying
revision: use object_array_filter() in implementation of gc_boundary()
object_array: add function object_array_filter()
revision: split some overly-long lines
cmd_diff(): make it obvious which cases are exclusive of each other
cmd_diff(): rename local variable "list" -> "entry"
...
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/submodule.c b/submodule.c index 1821a5b316..8685424898 100644 --- a/submodule.c +++ b/submodule.c @@ -845,7 +845,7 @@ static int find_first_merges(struct object_array *result, const char *path, struct commit *a, struct commit *b) { int i, j; - struct object_array merges; + struct object_array merges = OBJECT_ARRAY_INIT; struct commit *commit; int contains_another; @@ -855,7 +855,6 @@ static int find_first_merges(struct object_array *result, const char *path, struct rev_info revs; struct setup_revision_opt rev_opts; - memset(&merges, 0, sizeof(merges)); memset(result, 0, sizeof(struct object_array)); memset(&rev_opts, 0, sizeof(rev_opts)); @@ -893,8 +892,7 @@ static int find_first_merges(struct object_array *result, const char *path, } if (!contains_another) - add_object_array(merges.objects[i].item, - merges.objects[i].name, result); + add_object_array(merges.objects[i].item, NULL, result); } free(merges.objects); |