git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Correct new compiler warnings in builtin-revert
@ 2007-03-12 19:33 Shawn O. Pearce
  0 siblings, 0 replies; only message in thread
From: Shawn O. Pearce @ 2007-03-12 19:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The new builtin-revert code introduces a few new compiler errors
when I'm building with my stricter set of checks enabled in CFLAGS.
These all just stem from trying to store a constant string into
a non-const char*.  Simple fix, make the variables const char*.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 builtin-revert.c |    4 ++--
 cache.h          |    2 +-
 environment.c    |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin-revert.c b/builtin-revert.c
index 652eece..f3f3f5c 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -235,8 +235,8 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 	unsigned char head[20];
 	struct commit *base, *next;
 	int i;
-	char *oneline, *encoding, *reencoded_message = NULL;
-	const char *message;
+	char *oneline, *reencoded_message = NULL;
+	const char *message, *encoding;
 
 	git_config(git_default_config);
 	me = action == REVERT ? "revert" : "cherry-pick";
diff --git a/cache.h b/cache.h
index f172d02..4f10667 100644
--- a/cache.h
+++ b/cache.h
@@ -449,7 +449,7 @@ extern int check_repository_format_version(const char *var, const char *value);
 extern char git_default_email[MAX_GITNAME];
 extern char git_default_name[MAX_GITNAME];
 
-extern char *git_commit_encoding;
+extern const char *git_commit_encoding;
 extern const char *git_log_output_encoding;
 
 extern int copy_fd(int ifd, int ofd);
diff --git a/environment.c b/environment.c
index 0151ad0..fff4a4d 100644
--- a/environment.c
+++ b/environment.c
@@ -20,7 +20,7 @@ int is_bare_repository_cfg = -1; /* unspecified */
 int log_all_ref_updates = -1; /* unspecified */
 int warn_ambiguous_refs = 1;
 int repository_format_version;
-char *git_commit_encoding;
+const char *git_commit_encoding;
 const char *git_log_output_encoding;
 int shared_repository = PERM_UMASK;
 const char *apply_default_whitespace;
-- 
1.5.0.3.985.gcf0b4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-03-12 19:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-12 19:33 [PATCH] Correct new compiler warnings in builtin-revert Shawn O. Pearce

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).