summaryrefslogtreecommitdiff
path: root/tests/setenv.c
diff options
context:
space:
mode:
authorLi Jinjing <jinjingx.li@intel.com>2014-10-26 22:28:15 +0800
committerLi Jinjing <jinjingx.li@intel.com>2014-10-26 22:28:15 +0800
commit931b01b091932a1f796c23379ea32abb68bd5895 (patch)
tree3aa9e1125da84f7e3bd764bbff577c42a766508b /tests/setenv.c
parent7be93f2d05131d061bd4790ae33c8d50f50010d7 (diff)
downloadm4-931b01b091932a1f796c23379ea32abb68bd5895.tar.gz
m4-931b01b091932a1f796c23379ea32abb68bd5895.tar.bz2
m4-931b01b091932a1f796c23379ea32abb68bd5895.zip
Imported Upstream version 1.4.17upstream/1.4.17sandbox/jinjingx/upstream
Diffstat (limited to 'tests/setenv.c')
-rw-r--r--tests/setenv.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/setenv.c b/tests/setenv.c
index 7c06192..995a0f2 100644
--- a/tests/setenv.c
+++ b/tests/setenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2003, 2005-2011 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2003, 2005-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@ -15,12 +15,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if !_LIBC
-# include <config.h>
-#endif
-
/* 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_ARG_NONNULL(params)
+
+# define _GL_USE_STDLIB_ALLOC 1
+# include <config.h>
+#endif
#include <alloca.h>
@@ -48,7 +49,7 @@
#endif
#if _LIBC
-/* This lock protects against simultaneous modifications of `environ'. */
+/* This lock protects against simultaneous modifications of 'environ'. */
# include <bits/libc-lock.h>
__libc_lock_define_initialized (static, envlock)
# define LOCK __libc_lock_lock (envlock)
@@ -64,10 +65,6 @@ __libc_lock_define_initialized (static, envlock)
# define clearenv __clearenv
# define tfind __tfind
# define tsearch __tsearch
-#else
-/* Use the system functions, not the gnulib overrides in this file. */
-# undef malloc
-# undef realloc
#endif
/* In the GNU C library implementation we try to be more clever and
@@ -106,11 +103,11 @@ static void *known_values;
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
- 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
- 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. */
int
__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)
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
for Fortran 77) requires this function. */
int
@@ -353,6 +350,9 @@ weak_alias (__clearenv, clearenv)
#if HAVE_SETENV
# undef setenv
+# if !HAVE_DECL_SETENV
+extern int setenv (const char *, const char *, int);
+# endif
# define STREQ(a, b) (strcmp (a, b) == 0)
int