author | Junio C Hamano <gitster@pobox.com> | |
Wed, 14 Dec 2011 05:12:14 +0000 (21:12 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 14 Dec 2011 05:12:14 +0000 (21:12 -0800) |
* ml/mailmap:
mailmap: xcalloc mailmap_info
Conflicts:
mailmap.c
mailmap: xcalloc mailmap_info
Conflicts:
mailmap.c
1 | 2 | |||
---|---|---|---|---|
mailmap.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc mailmap.c
index 02fcfde0b0b786af5229559586cf8ff5758429bc,4892d497343a2d04812e331b379af2f8403db139..8c3196c7d76ff90e90a9fb4ff569aff6a429861a
+++ b/mailmap.c
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;
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);