Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-04-05 21:13:14 +0300
committerJunio C Hamano <gitster@pobox.com>2019-04-16 10:58:21 +0300
commit965cc517e57f01d8013fa7b10c1d5ce72ba3e272 (patch)
tree4a2db42b783e3bf09ed63e7a57637e4ce582a921 /server-info.c
parentb83a3089b584f622054e85b9bacbd18014259b7c (diff)
server-info: simplify cleanup in parse_pack_def()
We have two exits from the function: either we jump to the out_stale label or not. But in both exits we repeat our cleanup, and the only difference is our return value. Let's just use a variable for the return value to avoid repeating ourselves. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'server-info.c')
-rw-r--r--server-info.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/server-info.c b/server-info.c
index b61a6be4c2..ba44cece7f 100644
--- a/server-info.c
+++ b/server-info.c
@@ -133,6 +133,7 @@ static int read_pack_info_file(const char *infofile)
FILE *fp;
char line[1000];
int old_cnt = 0;
+ int stale = 1;
fp = fopen_or_warn(infofile, "r");
if (!fp)
@@ -161,11 +162,11 @@ static int read_pack_info_file(const char *infofile)
error("unrecognized: %s", line);
}
}
- fclose(fp);
- return 0;
+ stale = 0;
+
out_stale:
fclose(fp);
- return 1;
+ return stale;
}
static int compare_info(const void *a_, const void *b_)