# define clearenv __clearenv
# define tfind __tfind
# define tsearch __tsearch
+#else
+/* Use the system functions, not the gnulib overrides in this file. */
+# undef malloc
+# undef realloc
#endif
/* In the GNU C library implementation we try to be more clever and
__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;
: realloc (last_environ, (size + 2) * sizeof (char *)));
if (new_environ == NULL)
{
+ /* It's easier to set errno to ENOMEM than to rely on the
+ 'malloc-posix' and 'realloc-posix' gnulib modules. */
+ __set_errno (ENOMEM);
UNLOCK;
return -1;
}
if (np == NULL)
#endif
{
- np = malloc (namelen + 1 + vallen);
+ np = (char *) malloc (namelen + 1 + vallen);
if (np == NULL)
{
#if defined USE_TSEARCH && !defined _LIBC