From: Junio C Hamano Date: Wed, 14 Dec 2011 05:12:14 +0000 (-0800) Subject: Merge branch 'ml/mailmap' into maint-1.7.6 X-Git-Tag: v1.7.6.5~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6d1cdadbeeb03f40250526e29b1f1a91582911d8;p=git.git Merge branch 'ml/mailmap' into maint-1.7.6 * ml/mailmap: mailmap: xcalloc mailmap_info Conflicts: mailmap.c --- 6d1cdadbeeb03f40250526e29b1f1a91582911d8 diff --cc mailmap.c index 02fcfde0b,4892d4973..8c3196c7d --- a/mailmap.c +++ b/mailmap.c @@@ -69,9 -60,8 +69,8 @@@ static void add_mapping(struct string_l index = -1 - index; } else { /* create mailmap entry */ - struct string_list_item *item = string_list_insert_at_index(index, old_email, map); + struct string_list_item *item = string_list_insert_at_index(map, index, old_email); - item->util = xmalloc(sizeof(struct mailmap_entry)); - memset(item->util, 0, sizeof(struct mailmap_entry)); + item->util = xcalloc(1, sizeof(struct mailmap_entry)); ((struct mailmap_entry *)item->util)->namemap.strdup_strings = 1; } me = (struct mailmap_entry *)map->items[index].util; @@@ -79,16 -69,14 +78,16 @@@ if (old_name == NULL) { debug_mm("mailmap: adding (simple) entry for %s at index %d\n", old_email, index); /* Replace current name and new email for simple entry */ - free(me->name); - free(me->email); - if (new_name) + if (new_name) { + free(me->name); me->name = xstrdup(new_name); - if (new_email) + } + if (new_email) { + free(me->email); me->email = xstrdup(new_email); + } } else { - struct mailmap_info *mi = xmalloc(sizeof(struct mailmap_info)); + struct mailmap_info *mi = xcalloc(1, sizeof(struct mailmap_info)); debug_mm("mailmap: adding (complex) entry for %s at index %d\n", old_email, index); if (new_name) mi->name = xstrdup(new_name);