Skip to content

Commit

Permalink
compat/unsetenv.c: Fix a sparse warning
Browse files Browse the repository at this point in the history
The gitunsetenv function includes an (redundant) declaration of the
'environ' symbol, which is a pointer to the table of environment
variables. Unfortunately, on MinGW, this provokes sparse to issue
the following warning:

    compat/unsetenv.c:5:20: warning: non-ANSI function declaration of \
    function '__p__environ'

On MinGW, the <stdlib.h> header defines the 'environ' symbol as a
preprocessor macro (via _environ) which obtains the environ table
pointer via a call to the __p__environ() function.

In order to suppress the warning, we simply remove the redundant
declaration of the 'environ' symbol, since the symbol is already
declared correctly in <stdlib.h> (included via git-compat-util.h).

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ramsay Jones authored and Junio C Hamano committed Apr 28, 2013
1 parent eec7fd8 commit ec535cc
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion compat/unsetenv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

void gitunsetenv (const char *name)
{
extern char **environ;
int src, dst;
size_t nmln;

Expand Down

0 comments on commit ec535cc

Please sign in to comment.