aboutsummaryrefslogtreecommitdiff
path: root/builtin-help.c
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2009-06-08 22:34:31 +0200
committerJunio C Hamano <gitster@pobox.com>2009-06-09 00:15:57 -0700
commit4e2715fb9878235cb696f765695eef38078b0b7a (patch)
tree79f71194db1c0d1928b5c3eb222fb651f1be0f85 /builtin-help.c
parent0077138cd9d4f94636184553afd8b33b98d320a1 (diff)
downloadgit-4e2715fb9878235cb696f765695eef38078b0b7a.tar.gz
git-4e2715fb9878235cb696f765695eef38078b0b7a.tar.xz
Simplify some 'fprintf(stderr); return -1;' by using 'return error()'
Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-help.c')
-rw-r--r--builtin-help.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/builtin-help.c b/builtin-help.c
index af565fb65..6e53b2383 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -80,10 +80,9 @@ static int check_emacsclient_version(void)
ec_process.argv = argv_ec;
ec_process.err = -1;
ec_process.stdout_to_stderr = 1;
- if (start_command(&ec_process)) {
- fprintf(stderr, "Failed to start emacsclient.\n");
- return -1;
- }
+ if (start_command(&ec_process))
+ return error("Failed to start emacsclient.");
+
strbuf_read(&buffer, ec_process.err, 20);
close(ec_process.err);
@@ -94,20 +93,17 @@ static int check_emacsclient_version(void)
finish_command(&ec_process);
if (prefixcmp(buffer.buf, "emacsclient")) {
- fprintf(stderr, "Failed to parse emacsclient version.\n");
strbuf_release(&buffer);
- return -1;
+ return error("Failed to parse emacsclient version.");
}
strbuf_remove(&buffer, 0, strlen("emacsclient"));
version = atoi(buffer.buf);
if (version < 22) {
- fprintf(stderr,
- "emacsclient version '%d' too old (< 22).\n",
- version);
strbuf_release(&buffer);
- return -1;
+ return error("emacsclient version '%d' too old (< 22).",
+ version);
}
strbuf_release(&buffer);