changeset 17327:b1b7de2c4a71

careadlinkat: stop exporting careadlinkatcwd Only Emacs used it directly, and Emacs no longer needs it. * NEWS: Document this simplification. * lib/areadlink.c (careadlinkatcwd): Move here from careadlinkat.c, and make it static. Include <stdlib.h>, for abort, and unistd.h, for readlink. * lib/careadlinkat.c (careadlinkatcwd): Move to areadlink.c. Don't include stdlib.h; no longer needed. * lib/careadlinkat.h (careadlinkatcwd): Remove decl. * lib/relocwrapper.c: Adjust comment to match new dependencies. * modules/areadlink (Depends-on): Add readlink. (Maintainer): Add self. * modules/careadlinkat (Depends-on): Remove readlink.
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 08 Feb 2013 15:12:36 -0800
parents 6c93ff5bc2bd
children 30110a025c48 0fb629c87fb5
files ChangeLog NEWS lib/areadlink.c lib/careadlinkat.c lib/careadlinkat.h lib/relocwrapper.c modules/areadlink modules/careadlinkat
diffstat 8 files changed, 39 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2013-02-08  Paul Eggert  <eggert@cs.ucla.edu>
 
+	careadlinkat: stop exporting careadlinkatcwd
+	Only Emacs used it directly, and Emacs no longer needs it.
+	* NEWS: Document this simplification.
+	* lib/areadlink.c (careadlinkatcwd): Move here from careadlinkat.c,
+	and make it static.  Include <stdlib.h>, for abort, and unistd.h,
+	for readlink.
+	* lib/careadlinkat.c (careadlinkatcwd): Move to areadlink.c.
+	Don't include stdlib.h; no longer needed.
+	* lib/careadlinkat.h (careadlinkatcwd): Remove decl.
+	* lib/relocwrapper.c: Adjust comment to match new dependencies.
+	* modules/areadlink (Depends-on): Add readlink.
+	(Maintainer): Add self.
+	* modules/careadlinkat (Depends-on): Remove readlink.
+
 	extensions: port better to HP-UX
 	This is merged from git Autoconf.
 	* m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS):
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,9 @@
 
 Date        Modules         Changes
 
+2013-02-08  careadlinkat    This module no longer provides the careadlinkatcwd
+                            function.
+
 2012-06-26  getopt-posix    This module no longer guarantees that option
                             processing is resettable.  If your code uses
                             'optreset' or 'optind = 0;', rewrite it to make
--- a/lib/areadlink.c
+++ b/lib/areadlink.c
@@ -26,6 +26,23 @@
 
 #include "careadlinkat.h"
 
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Get the symbolic link value of FILENAME and put it into BUFFER, with
+   size BUFFER_SIZE.  This function acts like readlink but has
+   readlinkat's signature.  */
+static ssize_t
+careadlinkatcwd (int fd, char const *filename, char *buffer,
+                 size_t buffer_size)
+{
+  /* FD must be AT_FDCWD here, otherwise the caller is using this
+     function in contexts it was not meant for.  */
+  if (fd != AT_FDCWD)
+    abort ();
+  return readlink (filename, buffer, buffer_size);
+}
+
 /* Call readlink to get the symbolic link value of FILENAME.
    Return a pointer to that NUL-terminated string in malloc'd storage.
    If readlink fails, return NULL and set errno.
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -24,7 +24,6 @@
 
 #include <errno.h>
 #include <limits.h>
-#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
@@ -39,20 +38,6 @@
 
 #include "allocator.h"
 
-/* Get the symbolic link value of FILENAME and put it into BUFFER, with
-   size BUFFER_SIZE.  This function acts like readlink  but has
-   readlinkat's signature.  */
-ssize_t
-careadlinkatcwd (int fd, char const *filename, char *buffer,
-                 size_t buffer_size)
-{
-  /* FD must be AT_FDCWD here, otherwise the caller is using this
-     function in contexts for which it was not meant for.  */
-  if (fd != AT_FDCWD)
-    abort ();
-  return readlink (filename, buffer, buffer_size);
-}
-
 /* Assuming the current directory is FD, get the symbolic link value
    of FILENAME as a null-terminated string and put it into a buffer.
    If FD is AT_FDCWD, FILENAME is interpreted relative to the current
--- a/lib/careadlinkat.h
+++ b/lib/careadlinkat.h
@@ -52,21 +52,16 @@
                     ssize_t (*preadlinkat) (int, char const *,
                                             char *, size_t));
 
-/* Suitable values for careadlinkat's FD and PREADLINKAT arguments,
-   when doing a plain readlink:
-   Pass FD = AT_FDCWD and PREADLINKAT = careadlinkatcwd.  */
+/* Suitable value for careadlinkat's FD argument.  */
 #if HAVE_READLINKAT
 /* AT_FDCWD is declared in <fcntl.h>.  */
 #else
 /* Define AT_FDCWD independently, so that the careadlinkat module does
-   not depend on the fcntl-h module.  The value does not matter, since
-   careadlinkatcwd ignores it, but we might as well use the same value
+   not depend on the fcntl-h module.  We might as well use the same value
    as fcntl-h.  */
 # ifndef AT_FDCWD
 #  define AT_FDCWD (-3041965)
 # endif
 #endif
-ssize_t careadlinkatcwd (int fd, char const *filename,
-                         char *buffer, size_t buffer_size);
 
 #endif /* _GL_CAREADLINKAT_H */
--- a/lib/relocwrapper.c
+++ b/lib/relocwrapper.c
@@ -22,7 +22,7 @@
         -> areadlink
            -> careadlinkat
              -> allocator
-             -> readlink
+           -> readlink
         -> canonicalize-lgpl
            -> malloca
            -> readlink
--- a/modules/areadlink
+++ b/modules/areadlink
@@ -7,6 +7,7 @@
 
 Depends-on:
 careadlinkat
+readlink
 
 configure.ac:
 
@@ -20,4 +21,4 @@
 LGPLv2+
 
 Maintainer:
-Bruno Haible, Jim Meyering
+Paul Eggert, Bruno Haible, Jim Meyering
--- a/modules/careadlinkat
+++ b/modules/careadlinkat
@@ -7,7 +7,6 @@
 
 Depends-on:
 allocator
-readlink
 ssize_t
 unistd