1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Copyright (C) 1992, 1995-2002, 2005-2013 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
20 optimizes away the name == NULL test below. */
21 #define _GL_ARG_NONNULL(params)
30 # define __set_errno(ev) ((errno) = (ev))
37 # define __environ environ
41 /* This lock protects against simultaneous modifications of 'environ'. */
42 # include <bits/libc-lock.h>
43 __libc_lock_define_initialized (static, envlock)
44 # define LOCK __libc_lock_lock (envlock)
45 # define UNLOCK __libc_lock_unlock (envlock)
51 /* In the GNU C library we must keep the namespace clean. */
53 # define unsetenv __unsetenv
56 #if _LIBC || !HAVE_UNSETENV
59 unsetenv (const char *name)
64 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
76 if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
78 /* Found it. Remove this pointer by moving later ones back. */
84 /* Continue the loop in case NAME appears again. */
96 weak_alias (__unsetenv, unsetenv)
99 #else /* HAVE_UNSETENV */
102 # if !HAVE_DECL_UNSETENV
104 extern void unsetenv (const char *);
106 extern int unsetenv (const char *);
110 /* Call the underlying unsetenv, in case there is hidden bookkeeping
111 that needs updating beyond just modifying environ. */
113 rpl_unsetenv (const char *name)
116 if (!name || !*name || strchr (name, '='))
121 while (getenv (name))
129 #endif /* HAVE_UNSETENV */