summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-09-12 15:37:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-09-12 19:05:48 (GMT)
commitde2f95ebed260b5fb31942d6315994829fb6fc63 (patch)
tree731755bb74ae253f8c50320cfe251d80625c771d
parente230c568c4b9a991e3175e5f65171a566fd8e39c (diff)
downloadgit-de2f95ebed260b5fb31942d6315994829fb6fc63.zip
git-de2f95ebed260b5fb31942d6315994829fb6fc63.tar.gz
git-de2f95ebed260b5fb31942d6315994829fb6fc63.tar.bz2
mailmap: work around implementations with pure inline strcasecmp
On some systems (e.g. MinGW 4.0), string.h has only inline definition of strcasecmp and no non-inline implementation is supplied anywhere, which is, eh, "unusual". We cannot take an address of such a function to store it in namemap.cmp. Work it around by introducing our own level of indirection. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--mailmap.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/mailmap.c b/mailmap.c
index 44614fc..91a7532 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -52,6 +52,20 @@ static void free_mailmap_entry(void *p, const char *s)
string_list_clear_func(&me->namemap, free_mailmap_info);
}
+/*
+ * On some systems (e.g. MinGW 4.0), string.h has _only_ inline
+ * definition of strcasecmp and no non-inline implementation is
+ * supplied anywhere, which is, eh, "unusual"; we cannot take an
+ * address of such a function to store it in namemap.cmp. This is
+ * here as a workaround---do not assign strcasecmp directly to
+ * namemap.cmp until we know no systems that matter have such an
+ * "unusual" string.h.
+ */
+static int namemap_cmp(const char *a, const char *b)
+{
+ return strcasecmp(a, b);
+}
+
static void add_mapping(struct string_list *map,
char *new_name, char *new_email,
char *old_name, char *old_email)
@@ -75,7 +89,7 @@ static void add_mapping(struct string_list *map,
item = string_list_insert_at_index(map, index, old_email);
me = xcalloc(1, sizeof(struct mailmap_entry));
me->namemap.strdup_strings = 1;
- me->namemap.cmp = strcasecmp;
+ me->namemap.cmp = namemap_cmp;
item->util = me;
}
@@ -241,7 +255,7 @@ int read_mailmap(struct string_list *map, char **repo_abbrev)
int err = 0;
map->strdup_strings = 1;
- map->cmp = strcasecmp;
+ map->cmp = namemap_cmp;
if (!git_mailmap_blob && is_bare_repository())
git_mailmap_blob = "HEAD:.mailmap";