summaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-06 22:54:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-06 22:54:07 (GMT)
commit169c9c0169a00876f699678ac66ebe9563b0c29f (patch)
tree5344fd15a9134aa92eaf79ff5959f616cceffa17 /diff-lib.c
parentc14d5f99cd91347db3978c58c4b24d60ca29af75 (diff)
parentefdfe11f4f1f901db1ebfa7ebda6337293a2e5c5 (diff)
downloadgit-169c9c0169a00876f699678ac66ebe9563b0c29f.zip
git-169c9c0169a00876f699678ac66ebe9563b0c29f.tar.gz
git-169c9c0169a00876f699678ac66ebe9563b0c29f.tar.bz2
Merge branch 'bw/c-plus-plus'
Avoid using identifiers that clash with C++ keywords. Even though it is not a goal to compile Git with C++ compilers, changes like this help use of code analysis tools that targets C++ on our codebase. * bw/c-plus-plus: (37 commits) replace: rename 'new' variables trailer: rename 'template' variables tempfile: rename 'template' variables wrapper: rename 'template' variables environment: rename 'namespace' variables diff: rename 'template' variables environment: rename 'template' variables init-db: rename 'template' variables unpack-trees: rename 'new' variables trailer: rename 'new' variables submodule: rename 'new' variables split-index: rename 'new' variables remote: rename 'new' variables ref-filter: rename 'new' variables read-cache: rename 'new' variables line-log: rename 'new' variables imap-send: rename 'new' variables http: rename 'new' variables entry: rename 'new' variables diffcore-delta: rename 'new' variables ...
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/diff-lib.c b/diff-lib.c
index a228e1a..104f954 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -304,7 +304,7 @@ static int get_stat_data(const struct cache_entry *ce,
}
static void show_new_file(struct rev_info *revs,
- const struct cache_entry *new,
+ const struct cache_entry *new_file,
int cached, int match_missing)
{
const struct object_id *oid;
@@ -315,16 +315,16 @@ static void show_new_file(struct rev_info *revs,
* New file in the index: it might actually be different in
* the working tree.
*/
- if (get_stat_data(new, &oid, &mode, cached, match_missing,
+ if (get_stat_data(new_file, &oid, &mode, cached, match_missing,
&dirty_submodule, &revs->diffopt) < 0)
return;
- diff_index_show_file(revs, "+", new, oid, !is_null_oid(oid), mode, dirty_submodule);
+ diff_index_show_file(revs, "+", new_file, oid, !is_null_oid(oid), mode, dirty_submodule);
}
static int show_modified(struct rev_info *revs,
- const struct cache_entry *old,
- const struct cache_entry *new,
+ const struct cache_entry *old_entry,
+ const struct cache_entry *new_entry,
int report_missing,
int cached, int match_missing)
{
@@ -332,47 +332,47 @@ static int show_modified(struct rev_info *revs,
const struct object_id *oid;
unsigned dirty_submodule = 0;
- if (get_stat_data(new, &oid, &mode, cached, match_missing,
+ if (get_stat_data(new_entry, &oid, &mode, cached, match_missing,
&dirty_submodule, &revs->diffopt) < 0) {
if (report_missing)
- diff_index_show_file(revs, "-", old,
- &old->oid, 1, old->ce_mode,
+ diff_index_show_file(revs, "-", old_entry,
+ &old_entry->oid, 1, old_entry->ce_mode,
0);
return -1;
}
if (revs->combine_merges && !cached &&
- (oidcmp(oid, &old->oid) || oidcmp(&old->oid, &new->oid))) {
+ (oidcmp(oid, &old_entry->oid) || oidcmp(&old_entry->oid, &new_entry->oid))) {
struct combine_diff_path *p;
- int pathlen = ce_namelen(new);
+ int pathlen = ce_namelen(new_entry);
p = xmalloc(combine_diff_path_size(2, pathlen));
p->path = (char *) &p->parent[2];
p->next = NULL;
- memcpy(p->path, new->name, pathlen);
+ memcpy(p->path, new_entry->name, pathlen);
p->path[pathlen] = 0;
p->mode = mode;
oidclr(&p->oid);
memset(p->parent, 0, 2 * sizeof(struct combine_diff_parent));
p->parent[0].status = DIFF_STATUS_MODIFIED;
- p->parent[0].mode = new->ce_mode;
- oidcpy(&p->parent[0].oid, &new->oid);
+ p->parent[0].mode = new_entry->ce_mode;
+ oidcpy(&p->parent[0].oid, &new_entry->oid);
p->parent[1].status = DIFF_STATUS_MODIFIED;
- p->parent[1].mode = old->ce_mode;
- oidcpy(&p->parent[1].oid, &old->oid);
+ p->parent[1].mode = old_entry->ce_mode;
+ oidcpy(&p->parent[1].oid, &old_entry->oid);
show_combined_diff(p, 2, revs->dense_combined_merges, revs);
free(p);
return 0;
}
- oldmode = old->ce_mode;
- if (mode == oldmode && !oidcmp(oid, &old->oid) && !dirty_submodule &&
+ oldmode = old_entry->ce_mode;
+ if (mode == oldmode && !oidcmp(oid, &old_entry->oid) && !dirty_submodule &&
!revs->diffopt.flags.find_copies_harder)
return 0;
diff_change(&revs->diffopt, oldmode, mode,
- &old->oid, oid, 1, !is_null_oid(oid),
- old->name, 0, dirty_submodule);
+ &old_entry->oid, oid, 1, !is_null_oid(oid),
+ old_entry->name, 0, dirty_submodule);
return 0;
}