From: Eric Blake Date: Fri, 16 Apr 2010 20:21:29 +0000 (-0600) Subject: setenv: allow compilation with C++ X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=e37c1207ef427c4af2b5d16050e0e548e6384b4a;p=pspp 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 --- diff --git a/ChangeLog b/ChangeLog index 2a3f017de3..2360f0eea4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-04-16 Eric Blake + 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. diff --git a/lib/setenv.c b/lib/setenv.c index b4c5532290..ee9da0d809 100644 --- a/lib/setenv.c +++ b/lib/setenv.c @@ -112,8 +112,8 @@ int __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 @@ __add_to_environ (const char *name, const char *value, const char *combined, if (np == NULL) #endif { - np = malloc (namelen + 1 + vallen); + np = (char *) malloc (namelen + 1 + vallen); if (np == NULL) { #if defined USE_TSEARCH && !defined _LIBC