git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Habouzit <madcoder@debian.org>
To: git@vger.kernel.org
Cc: Pierre Habouzit <madcoder@debian.org>
Subject: [PATCH 2/7] git_dir holds pointers to local strings, hence MUST be const.
Date: Wed, 23 Aug 2006 12:39:11 +0200	[thread overview]
Message-ID: <11563295562422-git-send-email-madcoder@debian.org> (raw)
In-Reply-To: <11563295562072-git-send-email-madcoder@debian.org>

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
 cache.h       |    2 +-
 environment.c |    7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/cache.h b/cache.h
index 08d6a91..3044794 100644
--- a/cache.h
+++ b/cache.h
@@ -123,7 +123,7 @@ #define DB_ENVIRONMENT "GIT_OBJECT_DIREC
 #define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
 #define GRAFT_ENVIRONMENT "GIT_GRAFT_FILE"
 
-extern char *get_git_dir(void);
+extern const char *get_git_dir(void);
 extern char *get_object_directory(void);
 extern char *get_refs_directory(void);
 extern char *get_index_file(void);
diff --git a/environment.c b/environment.c
index e6bd003..5fae9ac 100644
--- a/environment.c
+++ b/environment.c
@@ -25,8 +25,9 @@ int zlib_compression_level = Z_DEFAULT_C
 int pager_in_use;
 int pager_use_color = 1;
 
-static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
-	*git_graft_file;
+static const char *git_dir;
+static char *git_object_dir, *git_index_file, *git_refs_dir, *git_graft_file;
+
 static void setup_git_env(void)
 {
 	git_dir = getenv(GIT_DIR_ENVIRONMENT);
@@ -49,7 +50,7 @@ static void setup_git_env(void)
 		git_graft_file = strdup(git_path("info/grafts"));
 }
 
-char *get_git_dir(void)
+const char *get_git_dir(void)
 {
 	if (!git_dir)
 		setup_git_env();
-- 
1.4.1.1

  reply	other threads:[~2006-08-23 10:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-23 10:39 [PATCH 1/7] avoid to use error that shadows the function name, use err instead Pierre Habouzit
2006-08-23 10:39 ` Pierre Habouzit [this message]
2006-08-23 10:39   ` [PATCH 3/7] missing 'static' keywords Pierre Habouzit
2006-08-23 10:39     ` [PATCH 4/7] remove ugly shadowing of loop indexes in subloops Pierre Habouzit
2006-08-23 10:39       ` [PATCH 5/7] missing #define DEBUG 0 that made the preprocessor whine Pierre Habouzit
2006-08-23 10:39         ` [PATCH 6/7] use name[len] in switch directly, instead of creating a shadowed variable Pierre Habouzit
2006-08-23 10:39           ` [PATCH 7/7] n is in fact unused, and is later shadowed Pierre Habouzit

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=11563295562422-git-send-email-madcoder@debian.org \
    --to=madcoder@debian.org \
    --cc=git@vger.kernel.org \
    /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).