git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Habouzit <madcoder@debian.org>
To: unlisted-recipients:; (no To-header on input)
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 4] janitor: useless checks before free
Date: Wed, 22 Jul 2009 23:51:55 +0200	[thread overview]
Message-ID: <20090722215154.GD13823@artemis.corp> (raw)

[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---

   On the same vein, a few simplifications wrt if (x) free(x)

 pack-revindex.c |    3 +--
 walker.c        |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/pack-revindex.c b/pack-revindex.c
index 1de53c8..77a0465 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -149,8 +149,7 @@ void discard_revindex(void)
 	if (pack_revindex_hashsz) {
 		int i;
 		for (i = 0; i < pack_revindex_hashsz; i++)
-			if (pack_revindex[i].revindex)
-				free(pack_revindex[i].revindex);
+			free(pack_revindex[i].revindex);
 		free(pack_revindex);
 		pack_revindex_hashsz = 0;
 	}
diff --git a/walker.c b/walker.c
index e57630e..11d9052 100644
--- a/walker.c
+++ b/walker.c
@@ -245,7 +245,7 @@ void walker_targets_free(int targets, char **target, const char **write_ref)
 {
 	while (targets--) {
 		free(target[targets]);
-		if (write_ref && write_ref[targets])
+		if (write_ref)
 			free((char *) write_ref[targets]);
 	}
 }
-- 
1.6.4.rc1.193.g47c25d


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

                 reply	other threads:[~2009-07-22 21:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090722215154.GD13823@artemis.corp \
    --to=madcoder@debian.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.
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).