From: Johannes Sixt <j6t@kdbg.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH 3/3] Simplify some 'fprintf(stderr); return -1;' by using 'return error()'
Date: Mon, 8 Jun 2009 22:34:31 +0200 [thread overview]
Message-ID: <7a02f50b758bfc6b9437f20cecea2d4628a5966a.1244492659.git.j6t@kdbg.org> (raw)
In-Reply-To: <8f487369337bdb1c9884b8f6e56530d25de85472.1244492659.git.j6t@kdbg.org>
In-Reply-To: <cover.1244492658.git.j6t@kdbg.org>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
builtin-help.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/builtin-help.c b/builtin-help.c
index af565fb..6e53b23 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);
--
1.6.3.17.g1665f
prev parent reply other threads:[~2009-06-08 20:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-08 20:34 [PATCH 0/3] Miscellanous cleanups around start_command/run_command callers Johannes Sixt
2009-06-08 20:34 ` [PATCH 1/3] Simplify some instances of run_command() by using run_command_v_opt() Johannes Sixt
2009-06-08 20:34 ` [PATCH 2/3] diff.c: plug a memory leak in an error path Johannes Sixt
2009-06-08 20:34 ` Johannes Sixt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7a02f50b758bfc6b9437f20cecea2d4628a5966a.1244492659.git.j6t@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).