builtin/gc.c: reduce scope of variables

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elia Pinto 2014-01-29 08:59:37 -08:00 committed by Junio C Hamano
parent bf7e645c90
commit 4f1c0b21e9

View File

@ -187,13 +187,12 @@ static int need_to_gc(void)
static const char *lock_repo_for_gc(int force, pid_t* ret_pid) static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
{ {
static struct lock_file lock; static struct lock_file lock;
static char locking_host[128];
char my_host[128]; char my_host[128];
struct strbuf sb = STRBUF_INIT; struct strbuf sb = STRBUF_INIT;
struct stat st; struct stat st;
uintmax_t pid; uintmax_t pid;
FILE *fp; FILE *fp;
int fd, should_exit; int fd;
if (pidfile) if (pidfile)
/* already locked */ /* already locked */
@ -205,6 +204,8 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
fd = hold_lock_file_for_update(&lock, git_path("gc.pid"), fd = hold_lock_file_for_update(&lock, git_path("gc.pid"),
LOCK_DIE_ON_ERROR); LOCK_DIE_ON_ERROR);
if (!force) { if (!force) {
static char locking_host[128];
int should_exit;
fp = fopen(git_path("gc.pid"), "r"); fp = fopen(git_path("gc.pid"), "r");
memset(locking_host, 0, sizeof(locking_host)); memset(locking_host, 0, sizeof(locking_host));
should_exit = should_exit =