aboutsummaryrefslogtreecommitdiff
path: root/builtin/gc.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-02-27 14:01:30 -0800
committerJunio C Hamano <gitster@pobox.com>2014-02-27 14:01:30 -0800
commit043478308feec3cda9b3473bc0b79396cb9d4db6 (patch)
tree59e92b4034e40876a6abfaccdef9a121679d51e8 /builtin/gc.c
parenta06f23c7393d187be3ded662102ec2b7b1b28bd0 (diff)
parent4f1c0b21e9045ff12e1880b5724a032031716a24 (diff)
downloadgit-043478308feec3cda9b3473bc0b79396cb9d4db6.tar.gz
git-043478308feec3cda9b3473bc0b79396cb9d4db6.tar.xz
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')
-rw-r--r--builtin/gc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index c19545d49..5bbb5e3cc 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("gc.pid"),
LOCK_DIE_ON_ERROR);
if (!force) {
+ static char locking_host[128];
+ int should_exit;
fp = fopen(git_path("gc.pid"), "r");
memset(locking_host, 0, sizeof(locking_host));
should_exit =