* lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC): Define.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Apr 2011 18:11:49 +0000 (11:11 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Apr 2011 20:31:40 +0000 (13:31 -0700)
(malloc, realloc): Don't #undef; no longer needed.

ChangeLog
lib/careadlinkat.c

index 6c9c17e..bf38cd7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
        stdlib: let modules use system malloc, realloc
        * lib/stdlib.in.h (malloc, realloc): Don't #define or add warnings
        if !_GL_USE_STDLIB_ALLOC.
+       * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC): Define.
+       (malloc, realloc): Don't #undef; no longer needed.
 
        careadlinkat: rename members to avoid problem
        * lib/allocator.h (struct allocator): Rename members from
index 0b54b1d..5f0d43c 100644 (file)
@@ -18,6 +18,7 @@
 
 /* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
 
+#define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 
 #include "careadlinkat.h"
@@ -52,10 +53,10 @@ careadlinkatcwd (int fd, char const *filename, char *buffer,
 }
 #endif
 
-/* Forward declaration.  We want to #undef malloc before initializing
-   this struct, but cannot do so until after all code that uses named
-   fields from "allocator.h" has been compiled.  */
-static struct allocator const standard_allocator;
+/* A standard allocator.  For now, only careadlinkat needs this, but
+   perhaps it should be moved to the allocator module.  */
+static struct allocator const standard_allocator =
+  { malloc, realloc, free, NULL };
 
 /* Assuming the current directory is FD, get the symbolic link value
    of FILENAME as a null-terminated string and put it into a buffer.
@@ -168,14 +169,3 @@ careadlinkat (int fd, char const *filename,
   errno = ENOMEM;
   return NULL;
 }
-
-/* Use the system functions, not the gnulib overrides, because this
-   module does not depend on GNU or POSIX semantics.  See comments
-   above why this must occur here.  */
-#undef malloc
-#undef realloc
-
-/* A standard allocator.  For now, only careadlinkat needs this, but
-   perhaps it should be moved to the allocator module.  */
-static struct allocator const standard_allocator =
-  { malloc, realloc, free, NULL };