# HG changeset patch # User Paul Eggert # Date 1360365156 28800 # Node ID b1b7de2c4a71e69dfe13e4ff8fa0d36591070e18 # Parent 6c93ff5bc2bd11a7f24ba3298162b99dd295bab2 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 , 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. diff -r 6c93ff5bc2bd -r b1b7de2c4a71 ChangeLog --- a/ChangeLog Fri Feb 08 13:10:01 2013 -0800 +++ b/ChangeLog Fri Feb 08 15:12:36 2013 -0800 @@ -1,5 +1,19 @@ 2013-02-08 Paul Eggert + 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 , 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): diff -r 6c93ff5bc2bd -r b1b7de2c4a71 NEWS --- a/NEWS Fri Feb 08 13:10:01 2013 -0800 +++ b/NEWS Fri Feb 08 15:12:36 2013 -0800 @@ -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 diff -r 6c93ff5bc2bd -r b1b7de2c4a71 lib/areadlink.c --- a/lib/areadlink.c Fri Feb 08 13:10:01 2013 -0800 +++ b/lib/areadlink.c Fri Feb 08 15:12:36 2013 -0800 @@ -26,6 +26,23 @@ #include "careadlinkat.h" +#include +#include + +/* 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. diff -r 6c93ff5bc2bd -r b1b7de2c4a71 lib/careadlinkat.c --- a/lib/careadlinkat.c Fri Feb 08 13:10:01 2013 -0800 +++ b/lib/careadlinkat.c Fri Feb 08 15:12:36 2013 -0800 @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -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 diff -r 6c93ff5bc2bd -r b1b7de2c4a71 lib/careadlinkat.h --- a/lib/careadlinkat.h Fri Feb 08 13:10:01 2013 -0800 +++ b/lib/careadlinkat.h Fri Feb 08 15:12:36 2013 -0800 @@ -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 . */ #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 */ diff -r 6c93ff5bc2bd -r b1b7de2c4a71 lib/relocwrapper.c --- a/lib/relocwrapper.c Fri Feb 08 13:10:01 2013 -0800 +++ b/lib/relocwrapper.c Fri Feb 08 15:12:36 2013 -0800 @@ -22,7 +22,7 @@ -> areadlink -> careadlinkat -> allocator - -> readlink + -> readlink -> canonicalize-lgpl -> malloca -> readlink diff -r 6c93ff5bc2bd -r b1b7de2c4a71 modules/areadlink --- a/modules/areadlink Fri Feb 08 13:10:01 2013 -0800 +++ b/modules/areadlink Fri Feb 08 15:12:36 2013 -0800 @@ -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 diff -r 6c93ff5bc2bd -r b1b7de2c4a71 modules/careadlinkat --- a/modules/careadlinkat Fri Feb 08 13:10:01 2013 -0800 +++ b/modules/careadlinkat Fri Feb 08 15:12:36 2013 -0800 @@ -7,7 +7,6 @@ Depends-on: allocator -readlink ssize_t unistd