From: Junio C Hamano Date: Fri, 18 Nov 2011 19:14:00 +0000 (-0800) Subject: Merge branch 'ml/mailmap' into maint X-Git-Tag: v1.7.7.4~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=79cfe0c5c4920bf68da548ad0d5bcdb425ce8d5f;p=git.git Merge branch 'ml/mailmap' into maint * ml/mailmap: mailmap: xcalloc mailmap_info Conflicts: mailmap.c --- 79cfe0c5c4920bf68da548ad0d5bcdb425ce8d5f 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);