> diff --git a/merge-recursive.c b/merge-recursive.c
> index 30894c1cc7..22c5e8e5c9 100644
> --- a/merge-recursive.c
> +++ b/merge-recursive.c

> +static struct hashmap *get_directory_renames(struct diff_queue_struct *pairs,
> +                                          struct tree *tree)
> +{
> +     struct hashmap *dir_renames;
> +     struct hashmap_iter iter;
> +     struct dir_rename_entry *entry;
> +     int i;
> +
> +     /*
> +      * Typically, we think of a directory rename as all files from a
> +      * certain directory being moved to a target directory.  However,
> +      * what if someone first moved two files from the original
> +      * directory in one commit, and then renamed the directory
> +      * somewhere else in a later commit?  At merge time, we just know
> +      * that files from the original directory went to two different
> +      * places, and that the bulk of them ended up in the same place.
> +      * We want each directory rename to represent where the bulk of the
> +      * files from that directory end up; this function exists to find
> +      * where the bulk of the files went.
> +      *
> +      * The first loop below simply iterates through the list of file
> +      * renames, finding out how often each directory rename pair
> +      * possibility occurs.
> +      */
> +     dir_renames = xmalloc(sizeof(struct hashmap));

Please use xmalloc(sizeof(*dir_renames)) instead, to avoid repeating the
data type.

> +     dir_rename_init(dir_renames);
> +     for (i = 0; i < pairs->nr; ++i) {
> +             struct string_list_item *item;
> +             int *count;
> +             struct diff_filepair *pair = pairs->queue[i];
> +             char *old_dir, *new_dir;
> +
> +             /* File not part of directory rename if it wasn't renamed */
> +             if (pair->status != 'R')
> +                     continue;
> +
> +             get_renamed_dir_portion(pair->one->path, pair->two->path,
> +                                     &old_dir,        &new_dir);
> +             if (!old_dir)
> +                     /* Directory didn't change at all; ignore this one. */
> +                     continue;
> +
> +             entry = dir_rename_find_entry(dir_renames, old_dir);
> +             if (!entry) {
> +                     entry = xmalloc(sizeof(struct dir_rename_entry));

Similarly: xmalloc(sizeof(*entry))

Reply via email to