Skip to content

Commit 6bf2227

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

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
@@ -628,7 +628,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
628628
if (*ptr == '/') {
629629
struct cache_entry *foundce;
630630
++ptr;
631-
foundce = index_name_exists(&the_index, ce->name, ptr - ce->name, ignore_case);
631+
foundce = index_name_exists(istate, ce->name, ptr - ce->name, ignore_case);
632632
if (foundce) {
633633
memcpy((void *)startPtr, foundce->name + (startPtr - ce->name), ptr - startPtr);
634634
startPtr = ptr;
@@ -981,7 +981,7 @@ int add_index_entry(struct index_state *istate, struct cache_entry *ce, int opti
981981
if (istate->cache_nr == istate->cache_alloc) {
982982
istate->cache_alloc = alloc_nr(istate->cache_alloc);
983983
istate->cache = xrealloc(istate->cache,
984-
istate->cache_alloc * sizeof(struct cache_entry *));
984+
istate->cache_alloc * sizeof(*istate->cache));
985985
}
986986

987987
/* Add it in.. */
@@ -1451,7 +1451,7 @@ int read_index_from(struct index_state *istate, const char *path)
14511451
istate->version = ntohl(hdr->hdr_version);
14521452
istate->cache_nr = ntohl(hdr->hdr_entries);
14531453
istate->cache_alloc = alloc_nr(istate->cache_nr);
1454-
istate->cache = xcalloc(istate->cache_alloc, sizeof(struct cache_entry *));
1454+
istate->cache = xcalloc(istate->cache_alloc, sizeof(*istate->cache));
14551455
istate->initialized = 1;
14561456

14571457
if (istate->version == 4)

0 commit comments

Comments
 (0)