path: root/builtin/gc.c
diff options
authorJunio C Hamano <>2014-02-27 22:01:30 (GMT)
committerJunio C Hamano <>2014-02-27 22:01:30 (GMT)
commit043478308feec3cda9b3473bc0b79396cb9d4db6 (patch)
tree59e92b4034e40876a6abfaccdef9a121679d51e8 /builtin/gc.c
parenta06f23c7393d187be3ded662102ec2b7b1b28bd0 (diff)
parent4f1c0b21e9045ff12e1880b5724a032031716a24 (diff)
Merge branch 'ep/varscope'
Shrink lifetime of variables by moving their definitions to an inner scope where appropriate. * ep/varscope: builtin/gc.c: reduce scope of variables builtin/fetch.c: reduce scope of variable builtin/commit.c: reduce scope of variables builtin/clean.c: reduce scope of variable builtin/blame.c: reduce scope of variables builtin/apply.c: reduce scope of variables bisect.c: reduce scope of variable
Diffstat (limited to 'builtin/gc.c')
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index c19545d..5bbb5e3 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -188,13 +188,12 @@ static int need_to_gc(void)
static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
static struct lock_file lock;
- static char locking_host[128];
char my_host[128];
struct strbuf sb = STRBUF_INIT;
struct stat st;
uintmax_t pid;
FILE *fp;
- int fd, should_exit;
+ int fd;
if (pidfile)
/* already locked */
@@ -206,6 +205,8 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
fd = hold_lock_file_for_update(&lock, git_path(""),
if (!force) {
+ static char locking_host[128];
+ int should_exit;
fp = fopen(git_path(""), "r");
memset(locking_host, 0, sizeof(locking_host));
should_exit =