git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 7/7] builtin/gc.c: reduce scope of variables

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Jan 29, 2014, 16:59 UTC
Message-ID
<1391014777-13582-1-git-send-email-gitter.spiros@gmail.com>
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 builtin/gc.c |    5 +++--
 1 file 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("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 =
-- 
1.7.10.4
Message 1 of 1 in “builtin/gc.c: reduce scope of variables”
  1. 7/7 builtin/gc.c: reduce scope of variablesElia Pinto, Jan 29, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.