git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Revert "compat/unsetenv.c: Fix a sparse warning"

From
Benoit Sigoure <tsunanet@gmail.com>
Date
Jul 21, 2013, 19:54 UTC
Message-ID
<1374436448-8199-1-git-send-email-tsunanet@gmail.com>
In-Reply-To
<1374387454-27800-1-git-send-email-tsunanet@gmail.com>
This reverts commit ec535cc27e6c4f5e0b1d157e04f5511f166ecd9d.

POSIX explicitly states "the [environ] variable, which must be declared by the user if it is to be used directly". Not declaring it causes compilation to fail on OS X.

Instead don't declare the variable on MinGW, as it causes a spurious warning there.

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
---
Resending as I forgot to Sign-off the previous patch.
 compat/unsetenv.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/compat/unsetenv.c b/compat/unsetenv.c
index 4ea1856..bf5fd70 100644
--- a/compat/unsetenv.c
+++ b/compat/unsetenv.c
@@ -2,6 +2,9 @@
 
 void gitunsetenv (const char *name)
 {
+#if !defined(__MINGW32__)
+     extern char **environ;
+#endif
      int src, dst;
      size_t nmln;
 
-- 
1.8.2.1.539.g4196a96
Previous: Benoit SigoureNext: Junio C Hamano
Message 9 of 10 in “Fix compilation on OS X.”
  1. Fix compilation on OS X.Benoit Sigoure, Jul 20, 2013
  2. Ramkumar RamachandraJul 20, 2013
  3. tsunaJul 20, 2013
  4. Torsten BögershausenJul 20, 2013
  5. Fix compilation on OS X.Benoit Sigoure, Jul 20, 2013
  6. Junio C HamanoJul 21, 2013
  7. tsunaJul 21, 2013
  8. Revert "compat/unsetenv.c: Fix a sparse warning"Benoit Sigoure, Jul 21, 2013
  9. Revert "compat/unsetenv.c: Fix a sparse warning"Benoit Sigoure, Jul 21, 2013
  10. Junio C HamanoJul 21, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.