X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fputenv.c;h=d0573c69f144b8b21c272e69b961b29d4461ad8a;hb=03400ebfaa064922caf3767d6641d7e1cdc8cd1b;hp=1d24a578de8b423344b910980aa59a5ccf2f49e0;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/lib/putenv.c b/lib/putenv.c index 1d24a578d..d0573c69f 100644 --- a/lib/putenv.c +++ b/lib/putenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1994, 1997, 1998, 2000, 2003, 2004, 2005, 2006, 2007 +/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2008 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C @@ -19,11 +19,8 @@ #include -/* undef putenv here, because some (e.g., Solaris 10) declare putenv in - with a non-const argument. That would conflict with the declaration of - rpl_putenv below (due to the #define putenv rpl_putenv from config.h). */ -#undef putenv -int rpl_putenv (char const *); +/* Specification. */ +#include #include @@ -95,7 +92,7 @@ _unsetenv (const char *name) /* Put STRING, which is of the form "NAME=VALUE", in the environment. If STRING contains no `=', then remove STRING from the environment. */ int -rpl_putenv (const char *string) +putenv (char *string) { const char *const name_end = strchr (string, '='); register size_t size; @@ -125,13 +122,12 @@ rpl_putenv (const char *string) size * sizeof (char *)); new_environ[size] = (char *) string; new_environ[size + 1] = NULL; - if (last_environ != NULL) - free (last_environ); + free (last_environ); last_environ = new_environ; environ = new_environ; } else - *ep = (char *) string; + *ep = string; return 0; }