unsetenv.c   unsetenv.c 
/* Copyright (C) 1992, 1995-2002, 2005-2010 Free Software Foundation, Inc. /* Copyright (C) 1992, 1995-2002, 2005-2014 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
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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 <http://www.gnu.org/licenses/>. * /
#include <config.h>
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the name == NULL test below. */ optimizes away the name == NULL test below. */
#define _GL_ARG_NONNULL(params) #define _GL_ARG_NONNULL(params)
#include <config.h>
/* Specification. */ /* Specification. */
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#if !_LIBC #if !_LIBC
# define __set_errno(ev) ((errno) = (ev)) # define __set_errno(ev) ((errno) = (ev))
#endif #endif
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#if !_LIBC #if !_LIBC
# define __environ environ # define __environ environ
#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)
# define UNLOCK __libc_lock_unlock (envlock) # define UNLOCK __libc_lock_unlock (envlock)
#else #else
# define LOCK # define LOCK
# define UNLOCK # define UNLOCK
#endif #endif
/* In the GNU C library we must keep the namespace clean. */ /* In the GNU C library we must keep the namespace clean. */
skipping to change at line 100 skipping to change at line 100
} }
#ifdef _LIBC #ifdef _LIBC
# undef unsetenv # undef unsetenv
weak_alias (__unsetenv, unsetenv) weak_alias (__unsetenv, unsetenv)
#endif #endif
#else /* HAVE_UNSETENV */ #else /* HAVE_UNSETENV */
# undef unsetenv # undef unsetenv
# if !HAVE_DECL_UNSETENV
# if VOID_UNSETENV
extern void unsetenv (const char *);
# else
extern int unsetenv (const char *);
# endif
# endif
/* Call the underlying unsetenv, in case there is hidden bookkeeping /* Call the underlying unsetenv, in case there is hidden bookkeeping
that needs updating beyond just modifying environ. */ that needs updating beyond just modifying environ. */
int int
rpl_unsetenv (const char *name) rpl_unsetenv (const char *name)
{ {
int result = 0; int result = 0;
if (!name || !*name || strchr (name, '=')) if (!name || !*name || strchr (name, '='))
{ {
errno = EINVAL; errno = EINVAL;
 End of changes. 5 change blocks. 
4 lines changed or deleted 11 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/