Skip to content

Commit ac5611a

Browse files
committed
Merge branch 'fc/do-not-use-the-index-in-add-to-index' into maint
* fc/do-not-use-the-index-in-add-to-index: read-cache: trivial style cleanups read-cache: fix wrong 'the_index' usage
2 parents a256a58 + c4aa316 commit ac5611a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

read-cache.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
626626
if (*ptr == '/') {
627627
struct cache_entry *foundce;
628628
++ptr;
629-
foundce = index_name_exists(&the_index, ce->name, ptr - ce->name, ignore_case);
629+
foundce = index_name_exists(istate, ce->name, ptr - ce->name, ignore_case);
630630
if (foundce) {
631631
memcpy((void *)startPtr, foundce->name + (startPtr - ce->name), ptr - startPtr);
632632
startPtr = ptr;
@@ -979,7 +979,7 @@ int add_index_entry(struct index_state *istate, struct cache_entry *ce, int opti
979979
if (istate->cache_nr == istate->cache_alloc) {
980980
istate->cache_alloc = alloc_nr(istate->cache_alloc);
981981
istate->cache = xrealloc(istate->cache,
982-
istate->cache_alloc * sizeof(struct cache_entry *));
982+
istate->cache_alloc * sizeof(*istate->cache));
983983
}
984984

985985
/* Add it in.. */
@@ -1449,7 +1449,7 @@ int read_index_from(struct index_state *istate, const char *path)
14491449
istate->version = ntohl(hdr->hdr_version);
14501450
istate->cache_nr = ntohl(hdr->hdr_entries);
14511451
istate->cache_alloc = alloc_nr(istate->cache_nr);
1452-
istate->cache = xcalloc(istate->cache_alloc, sizeof(struct cache_entry *));
1452+
istate->cache = xcalloc(istate->cache_alloc, sizeof(*istate->cache));
14531453
istate->initialized = 1;
14541454

14551455
if (istate->version == 4)

0 commit comments

Comments
 (0)