changeset 13239:81bcdef18cd8

setenv: allow compilation with C++ * lib/setenv.c (__add_to_environ): Add a cast. Also, drop use of register keyword. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Fri, 16 Apr 2010 14:21:29 -0600
parents 76c3bd5df2b8
children 2fe50700ce2c
files ChangeLog lib/setenv.c
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-04-16  Eric Blake  <eblake@redhat.com>
 
+	setenv: allow compilation with C++
+	* lib/setenv.c (__add_to_environ): Add a cast.  Also, drop use of
+	register keyword.
+
 	stdint: allow test to pass with C++
 	* tests/test-stdint.c: Define __STDC_CONSTANT_MACROS, for glibc.
 
--- a/lib/setenv.c
+++ b/lib/setenv.c
@@ -112,8 +112,8 @@
 __add_to_environ (const char *name, const char *value, const char *combined,
                   int replace)
 {
-  register char **ep;
-  register size_t size;
+  char **ep;
+  size_t size;
   const size_t namelen = strlen (name);
   const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
 
@@ -249,7 +249,7 @@
           if (np == NULL)
 #endif
             {
-              np = malloc (namelen + 1 + vallen);
+              np = (char *) malloc (namelen + 1 + vallen);
               if (np == NULL)
                 {
 #if defined USE_TSEARCH && !defined _LIBC