read-cache: rename 'new' variables
Rename C++ keyword in order to bring the codebase closer to being able to be compiled with a C++ compiler. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams committed
Feb 14, 2018 at 10:59 UTC
285c2e259dc147fbbf038e003324efa59536fdc0
1 file changed
+20
-20
read-cache.c
+20
-20
@@ -70,20 +70,20 @@ static void replace_index_entry(struct index_state *istate, int nr, struct cache
70
71
void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
72
{
73
- struct cache_entry *old = istate->cache[nr], *new;
73
+ struct cache_entry *old_entry = istate->cache[nr], *new_entry;
74
int namelen = strlen(new_name);
75
76
- new = xmalloc(cache_entry_size(namelen));
77
- copy_cache_entry(new, old);
78
- new->ce_flags &= ~CE_HASHED;
79
- new->ce_namelen = namelen;
80
- new->index = 0;
81
- memcpy(new->name, new_name, namelen + 1);
76
+ new_entry = xmalloc(cache_entry_size(namelen));
77
+ copy_cache_entry(new_entry, old_entry);
78
+ new_entry->ce_flags &= ~CE_HASHED;
79
+ new_entry->ce_namelen = namelen;
80
+ new_entry->index = 0;
81
+ memcpy(new_entry->name, new_name, namelen + 1);
82
83
- cache_tree_invalidate_path(istate, old->name);
84
- untracked_cache_remove_from_index(istate, old->name);
83
+ cache_tree_invalidate_path(istate, old_entry->name);
84
+ untracked_cache_remove_from_index(istate, old_entry->name);
85
remove_index_entry_at(istate, nr);
86
- add_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
86
+ add_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
87
}
88
89
void fill_stat_data(struct stat_data *sd, struct stat *st)
@@ -615,18 +615,18 @@ static struct cache_entry *create_alias_ce(struct index_state *istate,
615
struct cache_entry *alias)
616
{
617
int len;
618
- struct cache_entry *new;
618
+ struct cache_entry *new_entry;
619
620
if (alias->ce_flags & CE_ADDED)
621
die("Will not add file alias '%s' ('%s' already exists in index)", ce->name, alias->name);
622
623
/* Ok, create the new entry using the name of the existing alias */
624
len = ce_namelen(alias);
625
- new = xcalloc(1, cache_entry_size(len));
626
- memcpy(new->name, alias->name, len);
627
- copy_cache_entry(new, ce);
625
+ new_entry = xcalloc(1, cache_entry_size(len));
626
+ memcpy(new_entry->name, alias->name, len);
627
+ copy_cache_entry(new_entry, ce);
628
save_or_free_index_entry(istate, ce);
629
- return new;
629
+ return new_entry;
630
}
631
632
void set_object_name_for_intent_to_add_entry(struct cache_entry *ce)
@@ -1379,7 +1379,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
1379
added_fmt = (in_porcelain ? "A\t%s\n" : "%s needs update\n");
1380
unmerged_fmt = (in_porcelain ? "U\t%s\n" : "%s: needs merge\n");
1381
for (i = 0; i < istate->cache_nr; i++) {
1382
- struct cache_entry *ce, *new;
1382
+ struct cache_entry *ce, *new_entry;
1383
int cache_errno = 0;
1384
int changed = 0;
1385
int filtered = 0;
@@ -1408,10 +1408,10 @@ int refresh_index(struct index_state *istate, unsigned int flags,
1408
if (filtered)
1409
continue;
1410
1411
- new = refresh_cache_ent(istate, ce, options, &cache_errno, &changed);
1412
- if (new == ce)
1411
+ new_entry = refresh_cache_ent(istate, ce, options, &cache_errno, &changed);
1412
+ if (new_entry == ce)
1413
continue;
1414
- if (!new) {
1414
+ if (!new_entry) {
1415
const char *fmt;
1416
1417
if (really && cache_errno == EINVAL) {
@@ -1440,7 +1440,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
1440
continue;
1441
}
1442
1443
- replace_index_entry(istate, i, new);
1443
+ replace_index_entry(istate, i, new_entry);
1444
}
1445
return has_errors;
1446
}