git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: mhagger@alum.mit.edu
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>
Subject: [PATCH 1/2] cmd_fetch_pack(): declare dest to be const
Date: Wed,  2 May 2012 12:40:58 +0200	[thread overview]
Message-ID: <1335955259-15309-2-git-send-email-mhagger@alum.mit.edu> (raw)
In-Reply-To: <1335955259-15309-1-git-send-email-mhagger@alum.mit.edu>

From: Michael Haggerty <mhagger@alum.mit.edu>

There is no need for it to be non-const, and this avoids the need
for casting away constness of argv elements.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 builtin/fetch-pack.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 10db15b..7e9d62f 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -901,7 +901,8 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
 {
 	int i, ret, nr_heads;
 	struct ref *ref = NULL;
-	char *dest = NULL, **heads;
+	const char *dest = NULL;
+	char **heads;
 	int fd[2];
 	char *pack_lockfile = NULL;
 	char **pack_lockfile_ptr = NULL;
@@ -971,7 +972,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
 			}
 			usage(fetch_pack_usage);
 		}
-		dest = (char *)arg;
+		dest = arg;
 		heads = (char **)(argv + i + 1);
 		nr_heads = argc - i - 1;
 		break;
@@ -1018,7 +1019,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
 		fd[0] = 0;
 		fd[1] = 1;
 	} else {
-		conn = git_connect(fd, (char *)dest, args.uploadpack,
+		conn = git_connect(fd, dest, args.uploadpack,
 				   args.verbose ? CONNECT_VERBOSE : 0);
 	}
 
-- 
1.7.10

  reply	other threads:[~2012-05-02 10:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02 10:40 [PATCH 0/2] Fix some constness errors in fetch-pack mhagger
2012-05-02 10:40 ` mhagger [this message]
2012-05-02 10:40 ` [PATCH 2/2] cmd_fetch_pack(): fix constness problem and memory leak mhagger
2012-05-02 11:14   ` Nguyen Thai Ngoc Duy
2012-05-02 13:35     ` Michael Haggerty
2012-05-02 14:38       ` [PATCH 0/3] Fix some constness errors in fetch-pack and parseopt conversion Nguyễn Thái Ngọc Duy
2012-05-02 14:38         ` [PATCH 1/3] cmd_fetch_pack(): declare dest to be const Nguyễn Thái Ngọc Duy
2012-05-02 14:38         ` [PATCH 2/3] fetch-pack: use parse_options() Nguyễn Thái Ngọc Duy
2012-05-02 14:38         ` [PATCH 3/3] cmd_fetch_pack(): fix constness problem and memory leak Nguyễn Thái Ngọc Duy
2012-05-02 17:14     ` [PATCH 2/2] " Junio C Hamano
2012-05-21  1:47   ` Junio C Hamano
2012-05-21  8:13     ` Michael Haggerty
2012-05-19 14:05 ` [PATCH 0/2] Fix some constness errors in fetch-pack Michael Haggerty

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=1335955259-15309-2-git-send-email-mhagger@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --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).