git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Remove gitenv macro hack
@ 2005-05-19 22:01 Dan Weber
  2005-05-19 23:41 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Weber @ 2005-05-19 22:01 UTC (permalink / raw)
  To: Git Mailing List


Removed hacky macro for gitenv.  Often produced warnings by the compiler 
for the use of ?: without anything after the ?

Signed-off-by: Dan Weber <dan@mirrorlynx.com>

---
commit 1b48b369a152a6315a9b4e6eebf50f56176cdd82
tree 53c238f3aa788df47325c456ab16b0eb25004074
parent 5cd4c7b7686d334e341b21d92449349feda3ef65
author Dan Weber <dan@mirrorlynx.com> Thu, 19 May 2005 17:57:44 -0400
committer Dan Weber <dan@mirrorlynx.com> Thu, 19 May 2005 17:57:44 -0400

  cache.h |    8 +++++++-
  1 files changed, 7 insertions(+), 1 deletion(-)

Index: cache.h
===================================================================
--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/cache.h  (mode:100644)
+++ 53c238f3aa788df47325c456ab16b0eb25004074/cache.h  (mode:100644)
@@ -37,7 +37,13 @@
   * We accept older names for now but warn.
   */
  extern char *gitenv_bc(const char *);
-#define gitenv(e) (getenv(e) ? : gitenv_bc(e))
+static inline char* gitenv(const char* name) {
+       char* result = getenv(name);
+       if (result)
+               return result;
+       else
+               return gitenv_bc(name);
+}

  /*
   * Basic data structures for the directory cache


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Remove gitenv macro hack
  2005-05-19 22:01 [PATCH] Remove gitenv macro hack Dan Weber
@ 2005-05-19 23:41 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2005-05-19 23:41 UTC (permalink / raw)
  To: Dan Weber; +Cc: Git Mailing List

Please do not do this.

I believe we have that in quite a few places.  IIRC, it is one
of the Linus-approved GCC extensions and also used extensively
in the kernel source.

./cache.h:39:#define gitenv(e) (getenv(e) ? : gitenv_bc(e))
./commit-tree.c:149:	commitgecos = gitenv("GIT_COMMITTER_NAME") ? : realgecos;
./commit-tree.c:150:	commitemail = gitenv("GIT_COMMITTER_EMAIL") ? : realemail;
./commit-tree.c:151:	gecos = gitenv("GIT_AUTHOR_NAME") ? : realgecos;
./commit-tree.c:152:	email = gitenv("GIT_AUTHOR_EMAIL") ? : realemail;
./fsck-cache.c:359:	char *git_dir = gitenv(GIT_DIR_ENVIRONMENT) ? : DEFAULT_GIT_DIR_ENVIRONMENT;
./diff.c:35:	diff_opts = gitenv("GIT_DIFF_OPTS") ? : diff_opts;
./diff.c:358:		prepare_temp_file(other ? : name, &temp[1], two);
./diff.c:398:			builtin_diff(name, other ? : name, temp);
./diff.c:717:	diff_rename_minimum_score = minimum_score_ ? : MINIMUM_SCORE;
./sha1_file.c:203:	const char *alt = gitenv(ALTERNATE_DB_ENVIRONMENT) ? : "";
./sha1_file.c:215:			cp = strchr(last, ':') ? : last + strlen(last);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-19 23:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-19 22:01 [PATCH] Remove gitenv macro hack Dan Weber
2005-05-19 23:41 ` Junio C Hamano

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