diff options
author | Russell Belfer <rb@github.com> | 2012-11-09 11:19:46 -0800 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-11-09 13:52:07 -0800 |
commit | 0f3def715dc9af442f5f025c50a041c6319df1e8 (patch) | |
tree | e5a327bab384ab865471d019c83637b6ed167e3c /src | |
parent | 8064ecba2384df32d5b821398a346f0c96cf74d1 (diff) | |
download | libgit2-0f3def715dc9af442f5f025c50a041c6319df1e8.tar.gz |
Fix various cross-platform build issues
This fixes a number of warnings and problems with cross-platform
builds. Among other things, it's not safe to name a member of a
structure "strcmp" because that may be #defined.
Diffstat (limited to 'src')
-rw-r--r-- | src/checkout.c | 6 | ||||
-rw-r--r-- | src/diff.c | 30 | ||||
-rw-r--r-- | src/diff.h | 8 | ||||
-rw-r--r-- | src/diff_output.c | 4 |
4 files changed, 24 insertions, 24 deletions
diff --git a/src/checkout.c b/src/checkout.c index 2bad06501..8d164cfca 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -449,7 +449,7 @@ static int checkout_get_actions( if ((diff->opts.flags & GIT_DIFF_DELTAS_ARE_ICASE) != 0 && !hiter->ignore_case && (error = git_iterator_spoolandsort( - &hiter, hiter, diff->entrycmp, true)) < 0) + &hiter, hiter, diff->entrycomp, true)) < 0) goto fail; if ((error = git_iterator_current(hiter, &he)) < 0) @@ -470,8 +470,8 @@ static int checkout_get_actions( /* try to track HEAD entries parallel to deltas */ while (he) { cmp = S_ISDIR(delta->new_file.mode) ? - diff->prefixcmp(he->path, delta->new_file.path) : - diff->strcmp(he->path, delta->old_file.path); + diff->pfxcomp(he->path, delta->new_file.path) : + diff->strcomp(he->path, delta->old_file.path); if (cmp >= 0) break; if (git_iterator_advance(hiter, &he) < 0) diff --git a/src/diff.c b/src/diff.c index ea19d4799..6f48d72a2 100644 --- a/src/diff.c +++ b/src/diff.c @@ -528,7 +528,7 @@ static bool entry_is_prefixed( { size_t pathlen; - if (!prefix_item || diff->prefixcmp(prefix_item->path, item->path)) + if (!prefix_item || diff->pfxcomp(prefix_item->path, item->path)) return false; pathlen = strlen(item->path); @@ -551,17 +551,17 @@ static int diff_list_init_from_iterators( if (!old_iter->ignore_case && !new_iter->ignore_case) { diff->opts.flags &= ~GIT_DIFF_DELTAS_ARE_ICASE; - diff->strcmp = strcmp; - diff->strncmp = strncmp; - diff->prefixcmp = git__prefixcmp; - diff->entrycmp = git_index_entry__cmp; + diff->strcomp = strcmp; + diff->strncomp = strncmp; + diff->pfxcomp = git__prefixcmp; + diff->entrycomp = git_index_entry__cmp; } else { diff->opts.flags |= GIT_DIFF_DELTAS_ARE_ICASE; - diff->strcmp = strcasecmp; - diff->strncmp = strncasecmp; - diff->prefixcmp = git__prefixcmp_icase; - diff->entrycmp = git_index_entry__cmp_icase; + diff->strcomp = strcasecmp; + diff->strncomp = strncasecmp; + diff->pfxcomp = git__prefixcmp_icase; + diff->entrycomp = git_index_entry__cmp_icase; } return 0; @@ -592,12 +592,12 @@ static int diff_from_iterators( * merge join to the other iterator that is icase sorted */ if (!old_iter->ignore_case && git_iterator_spoolandsort( - &old_iter, old_iter, diff->entrycmp, true) < 0) + &old_iter, old_iter, diff->entrycomp, true) < 0) goto fail; if (!new_iter->ignore_case && git_iterator_spoolandsort( - &new_iter, new_iter, diff->entrycmp, true) < 0) + &new_iter, new_iter, diff->entrycomp, true) < 0) goto fail; } @@ -609,7 +609,7 @@ static int diff_from_iterators( while (oitem || nitem) { /* create DELETED records for old items not matched in new */ - if (oitem && (!nitem || diff->entrycmp(oitem, nitem) < 0)) { + if (oitem && (!nitem || diff->entrycomp(oitem, nitem) < 0)) { if (diff_delta__from_one(diff, GIT_DELTA_DELETED, oitem) < 0) goto fail; @@ -634,12 +634,12 @@ static int diff_from_iterators( /* create ADDED, TRACKED, or IGNORED records for new items not * matched in old (and/or descend into directories as needed) */ - else if (nitem && (!oitem || diff->entrycmp(oitem, nitem) > 0)) { + else if (nitem && (!oitem || diff->entrycomp(oitem, nitem) > 0)) { git_delta_t delta_type = GIT_DELTA_UNTRACKED; /* check if contained in ignored parent directory */ if (git_buf_len(&ignore_prefix) && - diff->prefixcmp(nitem->path, git_buf_cstr(&ignore_prefix)) == 0) + diff->pfxcomp(nitem->path, git_buf_cstr(&ignore_prefix)) == 0) delta_type = GIT_DELTA_IGNORED; if (S_ISDIR(nitem->mode)) { @@ -730,7 +730,7 @@ static int diff_from_iterators( * (or ADDED and DELETED pair if type changed) */ else { - assert(oitem && nitem && diff->entrycmp(oitem, nitem) == 0); + assert(oitem && nitem && diff->entrycomp(oitem, nitem) == 0); if (maybe_modified(old_iter, oitem, new_iter, nitem, diff) < 0 || git_iterator_advance(old_iter, &oitem) < 0 || diff --git a/src/diff.h b/src/diff.h index e9d8fd5a7..1e3be7593 100644 --- a/src/diff.h +++ b/src/diff.h @@ -42,10 +42,10 @@ struct git_diff_list { git_iterator_type_t new_src; uint32_t diffcaps; - int (*strcmp)(const char *, const char *); - int (*strncmp)(const char *, const char *, size_t); - int (*prefixcmp)(const char *str, const char *pfx); - int (*entrycmp)(const void *a, const void *b); + int (*strcomp)(const char *, const char *); + int (*strncomp)(const char *, const char *, size_t); + int (*pfxcomp)(const char *str, const char *pfx); + int (*entrycomp)(const void *a, const void *b); }; extern void git_diff__cleanup_modes( diff --git a/src/diff_output.c b/src/diff_output.c index 2f61540ff..46a9e02bf 100644 --- a/src/diff_output.c +++ b/src/diff_output.c @@ -120,7 +120,7 @@ static int diff_delta_is_binary_by_attr( return -1; mirror_new = (delta->new_file.path == delta->old_file.path || - strcmp(delta->new_file.path, delta->old_file.path) == 0); + ctxt->diff->strcomp(delta->new_file.path, delta->old_file.path) == 0); if (mirror_new) delta->new_file.flags |= (delta->old_file.flags & KNOWN_BINARY_FLAGS); else @@ -1002,7 +1002,7 @@ static int print_compact( git_buf_clear(pi->buf); if (delta->old_file.path != delta->new_file.path && - strcmp(delta->old_file.path,delta->new_file.path) != 0) + pi->diff->strcomp(delta->old_file.path,delta->new_file.path) != 0) git_buf_printf(pi->buf, "%c\t%s%c -> %s%c\n", code, delta->old_file.path, old_suffix, delta->new_file.path, new_suffix); else if (delta->old_file.mode != delta->new_file.mode && |