diff options
Diffstat (limited to 'gl/setenv.c')
-rw-r--r-- | gl/setenv.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/gl/setenv.c b/gl/setenv.c index ba760d6..995a0f2 100644 --- a/gl/setenv.c +++ b/gl/setenv.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 1992, 1995-2003, 2005-2010 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1992, 1995-2003, 2005-2013 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | 2 | This file is part of the GNU C Library. |
3 | 3 | ||
4 | This program is free software: you can redistribute it and/or modify | 4 | This program is free software: you can redistribute it and/or modify |
@@ -15,12 +15,13 @@ | |||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
16 | 16 | ||
17 | #if !_LIBC | 17 | #if !_LIBC |
18 | # include <config.h> | ||
19 | #endif | ||
20 | |||
21 | /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc | 18 | /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc |
22 | optimizes away the name == NULL test below. */ | 19 | optimizes away the name == NULL test below. */ |
23 | #define _GL_ARG_NONNULL(params) | 20 | # define _GL_ARG_NONNULL(params) |
21 | |||
22 | # define _GL_USE_STDLIB_ALLOC 1 | ||
23 | # include <config.h> | ||
24 | #endif | ||
24 | 25 | ||
25 | #include <alloca.h> | 26 | #include <alloca.h> |
26 | 27 | ||
@@ -48,7 +49,7 @@ | |||
48 | #endif | 49 | #endif |
49 | 50 | ||
50 | #if _LIBC | 51 | #if _LIBC |
51 | /* This lock protects against simultaneous modifications of `environ'. */ | 52 | /* This lock protects against simultaneous modifications of 'environ'. */ |
52 | # include <bits/libc-lock.h> | 53 | # include <bits/libc-lock.h> |
53 | __libc_lock_define_initialized (static, envlock) | 54 | __libc_lock_define_initialized (static, envlock) |
54 | # define LOCK __libc_lock_lock (envlock) | 55 | # define LOCK __libc_lock_lock (envlock) |
@@ -64,10 +65,6 @@ __libc_lock_define_initialized (static, envlock) | |||
64 | # define clearenv __clearenv | 65 | # define clearenv __clearenv |
65 | # define tfind __tfind | 66 | # define tfind __tfind |
66 | # define tsearch __tsearch | 67 | # define tsearch __tsearch |
67 | #else | ||
68 | /* Use the system functions, not the gnulib overrides in this file. */ | ||
69 | # undef malloc | ||
70 | # undef realloc | ||
71 | #endif | 68 | #endif |
72 | 69 | ||
73 | /* In the GNU C library implementation we try to be more clever and | 70 | /* In the GNU C library implementation we try to be more clever and |
@@ -106,11 +103,11 @@ static void *known_values; | |||
106 | static char **last_environ; | 103 | static char **last_environ; |
107 | 104 | ||
108 | 105 | ||
109 | /* This function is used by `setenv' and `putenv'. The difference between | 106 | /* This function is used by 'setenv' and 'putenv'. The difference between |
110 | the two functions is that for the former must create a new string which | 107 | the two functions is that for the former must create a new string which |
111 | is then placed in the environment, while the argument of `putenv' | 108 | is then placed in the environment, while the argument of 'putenv' |
112 | must be used directly. This is all complicated by the fact that we try | 109 | must be used directly. This is all complicated by the fact that we try |
113 | to reuse values once generated for a `setenv' call since we can never | 110 | to reuse values once generated for a 'setenv' call since we can never |
114 | free the strings. */ | 111 | free the strings. */ |
115 | int | 112 | int |
116 | __add_to_environ (const char *name, const char *value, const char *combined, | 113 | __add_to_environ (const char *name, const char *value, const char *combined, |
@@ -302,7 +299,7 @@ setenv (const char *name, const char *value, int replace) | |||
302 | return __add_to_environ (name, value, NULL, replace); | 299 | return __add_to_environ (name, value, NULL, replace); |
303 | } | 300 | } |
304 | 301 | ||
305 | /* The `clearenv' was planned to be added to POSIX.1 but probably | 302 | /* The 'clearenv' was planned to be added to POSIX.1 but probably |
306 | never made it. Nevertheless the POSIX.9 standard (POSIX bindings | 303 | never made it. Nevertheless the POSIX.9 standard (POSIX bindings |
307 | for Fortran 77) requires this function. */ | 304 | for Fortran 77) requires this function. */ |
308 | int | 305 | int |
@@ -353,6 +350,9 @@ weak_alias (__clearenv, clearenv) | |||
353 | #if HAVE_SETENV | 350 | #if HAVE_SETENV |
354 | 351 | ||
355 | # undef setenv | 352 | # undef setenv |
353 | # if !HAVE_DECL_SETENV | ||
354 | extern int setenv (const char *, const char *, int); | ||
355 | # endif | ||
356 | # define STREQ(a, b) (strcmp (a, b) == 0) | 356 | # define STREQ(a, b) (strcmp (a, b) == 0) |
357 | 357 | ||
358 | int | 358 | int |