Skip to content

Commit 4f1c0b2

Browse files
devzero2000gitster
authored andcommitted
builtin/gc.c: reduce scope of variables
Signed-off-by: Elia Pinto <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bf7e645 commit 4f1c0b2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

builtin/gc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,12 @@ static int need_to_gc(void)
187187
static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
188188
{
189189
static struct lock_file lock;
190-
static char locking_host[128];
191190
char my_host[128];
192191
struct strbuf sb = STRBUF_INIT;
193192
struct stat st;
194193
uintmax_t pid;
195194
FILE *fp;
196-
int fd, should_exit;
195+
int fd;
197196

198197
if (pidfile)
199198
/* already locked */
@@ -205,6 +204,8 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
205204
fd = hold_lock_file_for_update(&lock, git_path("gc.pid"),
206205
LOCK_DIE_ON_ERROR);
207206
if (!force) {
207+
static char locking_host[128];
208+
int should_exit;
208209
fp = fopen(git_path("gc.pid"), "r");
209210
memset(locking_host, 0, sizeof(locking_host));
210211
should_exit =

0 commit comments

Comments
 (0)