{"thread":{"id":"666","subject":"[PATCH] Remove gitenv macro hack","startedAt":"2005-05-19T22:01:17Z","lastAt":"2005-05-19T23:41:43Z","messageCount":2,"participants":["Dan Weber","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"3586","messageId":"Pine.LNX.4.62.0505191800280.16809@mirrorlynx.com","threadId":"666","inReplyTo":null,"subject":"[PATCH] Remove gitenv macro hack","fromName":"Dan Weber","fromEmail":"dan@mirrorlynx.com","sentAt":"2005-05-19T22:01:17Z","receivedAt":"2005-05-19T22:01:17Z","isPatch":true,"sender":{"key":"dan@mirrorlynx.com","avatar":null},"body":"\nRemoved hacky macro for gitenv.  Often produced warnings by the compiler \nfor the use of ?: without anything after the ?\n\nSigned-off-by: Dan Weber <dan@mirrorlynx.com>\n\n---\ncommit 1b48b369a152a6315a9b4e6eebf50f56176cdd82\ntree 53c238f3aa788df47325c456ab16b0eb25004074\nparent 5cd4c7b7686d334e341b21d92449349feda3ef65\nauthor Dan Weber <dan@mirrorlynx.com> Thu, 19 May 2005 17:57:44 -0400\ncommitter Dan Weber <dan@mirrorlynx.com> Thu, 19 May 2005 17:57:44 -0400\n\n  cache.h |    8 +++++++-\n  1 files changed, 7 insertions(+), 1 deletion(-)\n\nIndex: cache.h\n===================================================================\n--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/cache.h  (mode:100644)\n+++ 53c238f3aa788df47325c456ab16b0eb25004074/cache.h  (mode:100644)\n@@ -37,7 +37,13 @@\n   * We accept older names for now but warn.\n   */\n  extern char *gitenv_bc(const char *);\n-#define gitenv(e) (getenv(e) ? : gitenv_bc(e))\n+static inline char* gitenv(const char* name) {\n+       char* result = getenv(name);\n+       if (result)\n+               return result;\n+       else\n+               return gitenv_bc(name);\n+}\n\n  /*\n   * Basic data structures for the directory cache\n\n"},{"id":"3589","messageId":"7vd5rmyea0.fsf@assigned-by-dhcp.cox.net","threadId":"666","inReplyTo":"Pine.LNX.4.62.0505191800280.16809@mirrorlynx.com","subject":"Re: [PATCH] Remove gitenv macro hack","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-19T23:41:43Z","receivedAt":"2005-05-19T23:41:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Please do not do this.\n\nI believe we have that in quite a few places.  IIRC, it is one\nof the Linus-approved GCC extensions and also used extensively\nin the kernel source.\n\n./cache.h:39:#define gitenv(e) (getenv(e) ? : gitenv_bc(e))\n./commit-tree.c:149:\tcommitgecos = gitenv(\"GIT_COMMITTER_NAME\") ? : realgecos;\n./commit-tree.c:150:\tcommitemail = gitenv(\"GIT_COMMITTER_EMAIL\") ? : realemail;\n./commit-tree.c:151:\tgecos = gitenv(\"GIT_AUTHOR_NAME\") ? : realgecos;\n./commit-tree.c:152:\temail = gitenv(\"GIT_AUTHOR_EMAIL\") ? : realemail;\n./fsck-cache.c:359:\tchar *git_dir = gitenv(GIT_DIR_ENVIRONMENT) ? : DEFAULT_GIT_DIR_ENVIRONMENT;\n./diff.c:35:\tdiff_opts = gitenv(\"GIT_DIFF_OPTS\") ? : diff_opts;\n./diff.c:358:\t\tprepare_temp_file(other ? : name, &temp[1], two);\n./diff.c:398:\t\t\tbuiltin_diff(name, other ? : name, temp);\n./diff.c:717:\tdiff_rename_minimum_score = minimum_score_ ? : MINIMUM_SCORE;\n./sha1_file.c:203:\tconst char *alt = gitenv(ALTERNATE_DB_ENVIRONMENT) ? : \"\";\n./sha1_file.c:215:\t\t\tcp = strchr(last, ':') ? : last + strlen(last);\n\n"}]}