+2011-04-08 Paul Eggert <eggert@cs.ucla.edu>
+
+ careadlinkat: rename members to avoid problem
+ * lib/allocator.h (struct allocator): Rename members from
+ malloc/realloc to allocate/reallocate, to avoid problems if malloc
+ and realloc are #define'd. Reported by Eric Blake in
+ <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00091.html>.
+ * lib/careadlinkat.c (careadlinkat): Adjust to renaming.
+
2011-04-08 Eric Blake <eblake@redhat.com>
nonblocking: reduce dependency
attributes do not work with pointers to functions. See
<http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00007.html>. */
- /* Call MALLOC to allocate memory, like 'malloc'. On failure MALLOC
+ /* Call ALLOCATE to allocate memory, like 'malloc'. On failure ALLOCATE
should return NULL, though not necessarily set errno. When given
a zero size it may return NULL even if successful. */
- void *(*malloc) (size_t);
+ void *(*allocate) (size_t);
- /* If nonnull, call REALLOC to reallocate memory, like 'realloc'.
- On failure REALLOC should return NULL, though not necessarily set
+ /* If nonnull, call REALLOCATE to reallocate memory, like 'realloc'.
+ On failure REALLOCATE should return NULL, though not necessarily set
errno. When given a zero size it may return NULL even if
successful. */
- void *(*realloc) (void *, size_t);
+ void *(*reallocate) (void *, size_t);
/* Call FREE to free memory, like 'free'. */
void (*free) (void *);
if (buf == stack_buf)
{
- char *b = (char *) alloc->malloc (link_size);
+ char *b = (char *) alloc->allocate (link_size);
if (! b)
break;
memcpy (b, buf, link_size);
buf = b;
}
- else if (link_size < buf_size && buf != buffer && alloc->realloc)
+ else if (link_size < buf_size && buf != buffer && alloc->reallocate)
{
/* Shrink BUF before returning it. */
- char *b = (char *) alloc->realloc (buf, link_size);
+ char *b = (char *) alloc->reallocate (buf, link_size);
if (b)
buf = b;
}
buf_size = buf_size_max;
else
break;
- buf = (char *) alloc->malloc (buf_size);
+ buf = (char *) alloc->allocate (buf_size);
}
while (buf);