git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Barr <davidbarr@google.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Jonathan Nieder <jrnieder@gmail.com>, David Barr <davidbarr@google.com>
Subject: [PATCH v2 2/6] vcs-svn: simplify cleanup in apply_one_window()
Date: Fri,  1 Jun 2012 00:41:26 +1000	[thread overview]
Message-ID: <1338475290-22644-3-git-send-email-davidbarr@google.com> (raw)
In-Reply-To: <1338475290-22644-1-git-send-email-davidbarr@google.com>

As a side-effect, fix clang-analyzer warning:

vcs-svn/svndiff.c:278:3: warning: expression result unused [-Wunused-value]
                error("invalid delta: incorrect postimage length");
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This warning caused by an insanely concise error() upstream.

Signed-off-by: David Barr <davidbarr@google.com>
---
 vcs-svn/svndiff.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c
index 57d647d..11a0e38 100644
--- a/vcs-svn/svndiff.c
+++ b/vcs-svn/svndiff.c
@@ -258,6 +258,7 @@ static int apply_window_in_core(struct window *ctx)
 static int apply_one_window(struct line_buffer *delta, off_t *delta_len,
 			    struct sliding_view *preimage, FILE *out)
 {
+	int rv = -1;
 	struct window ctx = WINDOW_INIT(preimage);
 	size_t out_len;
 	size_t instructions_len;
@@ -275,16 +276,15 @@ static int apply_one_window(struct line_buffer *delta, off_t *delta_len,
 	if (apply_window_in_core(&ctx))
 		goto error_out;
 	if (ctx.out.len != out_len) {
-		error("invalid delta: incorrect postimage length");
+		rv = error("invalid delta: incorrect postimage length");
 		goto error_out;
 	}
 	if (write_strbuf(&ctx.out, out))
 		goto error_out;
-	window_release(&ctx);
-	return 0;
+	rv = 0;
 error_out:
 	window_release(&ctx);
-	return -1;
+	return rv;
 }
 
 int svndiff0_apply(struct line_buffer *delta, off_t delta_len,
-- 
1.7.10.2

  parent reply	other threads:[~2012-05-31 14:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-31 14:41 [PATCH v2 0/6] vcs-svn: housekeeping David Barr
2012-05-31 14:41 ` [PATCH v2 1/6] vcs-svn: fix clang-analyzer error David Barr
2012-05-31 14:41 ` David Barr [this message]
2012-05-31 14:41 ` [PATCH v2 3/6] vcs-svn: prefer constcmp to prefixcmp David Barr
2012-06-01 16:27   ` Junio C Hamano
2012-06-01 16:43     ` David Michael Barr
2012-05-31 14:41 ` [PATCH v2 4/6] vcs-svn: prefer strstr over memmem David Barr
2012-05-31 14:41 ` [PATCH v2 5/6] vcs-svn: fix signedness warnings David Barr
2012-05-31 14:41 ` [PATCH v2 6/6] vcs-svn: drop no-op reset methods David Barr
2012-06-01  4:26   ` David Michael Barr

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338475290-22644-3-git-send-email-davidbarr@google.com \
    --to=davidbarr@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.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.
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 NNTP newsgroup(s).