Skip to content

Commit 7db2d08

Browse files
pcloudsgitster
authored andcommitted
read-cache.c: change type of "temp" in write_shared_index()
This local variable 'temp' will be passed in from the caller in the next patch. To reduce patch noise, let's change its type now while it's still a local variable and get all the trival conversion out of the next patch. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0c37383 commit 7db2d08

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

read-cache.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,30 +2474,32 @@ static int clean_shared_index_files(const char *current_hex)
24742474
static int write_shared_index(struct index_state *istate,
24752475
struct lock_file *lock, unsigned flags)
24762476
{
2477-
struct tempfile *temp;
2477+
struct tempfile *real_temp;
2478+
struct tempfile **temp = &real_temp;
24782479
struct split_index *si = istate->split_index;
24792480
int ret;
24802481

2481-
temp = mks_tempfile(git_path("sharedindex_XXXXXX"));
2482-
if (!temp) {
2482+
real_temp = mks_tempfile(git_path("sharedindex_XXXXXX"));
2483+
if (!real_temp) {
24832484
hashclr(si->base_sha1);
24842485
return do_write_locked_index(istate, lock, flags);
24852486
}
2487+
temp = &real_temp;
24862488
move_cache_to_base_index(istate);
2487-
ret = do_write_index(si->base, temp, 1);
2489+
ret = do_write_index(si->base, *temp, 1);
24882490
if (ret) {
2489-
delete_tempfile(&temp);
2491+
delete_tempfile(temp);
24902492
return ret;
24912493
}
2492-
ret = adjust_shared_perm(get_tempfile_path(temp));
2494+
ret = adjust_shared_perm(get_tempfile_path(*temp));
24932495
if (ret) {
24942496
int save_errno = errno;
2495-
error("cannot fix permission bits on %s", get_tempfile_path(temp));
2496-
delete_tempfile(&temp);
2497+
error("cannot fix permission bits on %s", get_tempfile_path(*temp));
2498+
delete_tempfile(temp);
24972499
errno = save_errno;
24982500
return ret;
24992501
}
2500-
ret = rename_tempfile(&temp,
2502+
ret = rename_tempfile(temp,
25012503
git_path("sharedindex.%s", sha1_to_hex(si->base->sha1)));
25022504
if (!ret) {
25032505
hashcpy(si->base_sha1, si->base->sha1);

0 commit comments

Comments
 (0)