|
version 1.1.1.2, 2012/05/29 09:29:43
|
version 1.1.1.3, 2021/03/17 13:38:46
|
|
Line 1
|
Line 1
|
| /* Copyright (C) 1992, 1995-2003, 2005-2011 Free Software Foundation, Inc. | /* Copyright (C) 1992, 1995-2003, 2005-2019 Free Software Foundation, Inc. |
| This file is part of the GNU C Library. |
This file is part of the GNU C Library. |
| |
|
| This program is free software: you can redistribute it and/or modify |
This program is free software: you can redistribute it and/or modify |
|
Line 12
|
Line 12
|
| GNU General Public License for more details. |
GNU General Public License for more details. |
| |
|
| You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
| along with this program. If not, see <http://www.gnu.org/licenses/>. */ | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| |
|
| #if !_LIBC |
#if !_LIBC |
| |
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc |
| |
optimizes away the name == NULL test below. */ |
| |
# define _GL_ARG_NONNULL(params) |
| |
|
| # define _GL_USE_STDLIB_ALLOC 1 |
# define _GL_USE_STDLIB_ALLOC 1 |
| # include <config.h> |
# include <config.h> |
| #endif |
#endif |
| |
|
| /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc |
|
| optimizes away the name == NULL test below. */ |
|
| #define _GL_ARG_NONNULL(params) |
|
| |
|
| #include <alloca.h> |
#include <alloca.h> |
| |
|
| /* Specification. */ |
/* Specification. */ |
|
Line 49
|
Line 49
|
| #endif |
#endif |
| |
|
| #if _LIBC |
#if _LIBC |
| /* This lock protects against simultaneous modifications of `environ'. */ | /* This lock protects against simultaneous modifications of 'environ'. */ |
| # include <bits/libc-lock.h> |
# include <bits/libc-lock.h> |
| __libc_lock_define_initialized (static, envlock) |
__libc_lock_define_initialized (static, envlock) |
| # define LOCK __libc_lock_lock (envlock) |
# define LOCK __libc_lock_lock (envlock) |
|
Line 103 static void *known_values;
|
Line 103 static void *known_values;
|
| static char **last_environ; |
static char **last_environ; |
| |
|
| |
|
| /* This function is used by `setenv' and `putenv'. The difference between | /* This function is used by 'setenv' and 'putenv'. The difference between |
| the two functions is that for the former must create a new string which |
the two functions is that for the former must create a new string which |
| is then placed in the environment, while the argument of `putenv' | is then placed in the environment, while the argument of 'putenv' |
| must be used directly. This is all complicated by the fact that we try |
must be used directly. This is all complicated by the fact that we try |
| to reuse values once generated for a `setenv' call since we can never | to reuse values once generated for a 'setenv' call since we can never |
| free the strings. */ |
free the strings. */ |
| int |
int |
| __add_to_environ (const char *name, const char *value, const char *combined, |
__add_to_environ (const char *name, const char *value, const char *combined, |
|
Line 299 setenv (const char *name, const char *value, int repla
|
Line 299 setenv (const char *name, const char *value, int repla
|
| return __add_to_environ (name, value, NULL, replace); |
return __add_to_environ (name, value, NULL, replace); |
| } |
} |
| |
|
| /* The `clearenv' was planned to be added to POSIX.1 but probably | /* The 'clearenv' was planned to be added to POSIX.1 but probably |
| never made it. Nevertheless the POSIX.9 standard (POSIX bindings |
never made it. Nevertheless the POSIX.9 standard (POSIX bindings |
| for Fortran 77) requires this function. */ |
for Fortran 77) requires this function. */ |
| int |
int |