[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] careadlinkat: stop exporting careadlinkatcwd
From: |
Paul Eggert |
Subject: |
[PATCH] careadlinkat: stop exporting careadlinkatcwd |
Date: |
Fri, 08 Feb 2013 15:31:10 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 |
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.
---
ChangeLog | 14 ++++++++++++++
NEWS | 3 +++
lib/areadlink.c | 17 +++++++++++++++++
lib/careadlinkat.c | 15 ---------------
lib/careadlinkat.h | 9 ++-------
lib/relocwrapper.c | 2 +-
modules/areadlink | 3 ++-
modules/careadlinkat | 1 -
8 files changed, 39 insertions(+), 25 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fa5bda0..b030833 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2013-02-08 Paul Eggert <address@hidden>
+ 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):
diff --git a/NEWS b/NEWS
index 87966b8..2227d3f 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,9 @@ User visible incompatible changes
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 --git a/lib/areadlink.c b/lib/areadlink.c
index fe65cc6..7b81685 100644
--- 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.
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
index 1a759be..e2c19d1 100644
--- 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
diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h
index 5cdb813..46f88ae 100644
--- a/lib/careadlinkat.h
+++ b/lib/careadlinkat.h
@@ -52,21 +52,16 @@ char *careadlinkat (int fd, char const *filename,
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 */
diff --git a/lib/relocwrapper.c b/lib/relocwrapper.c
index 8c08744..a484839 100644
--- a/lib/relocwrapper.c
+++ b/lib/relocwrapper.c
@@ -22,7 +22,7 @@
-> areadlink
-> careadlinkat
-> allocator
- -> readlink
+ -> readlink
-> canonicalize-lgpl
-> malloca
-> readlink
diff --git a/modules/areadlink b/modules/areadlink
index daf0232..908f667 100644
--- a/modules/areadlink
+++ b/modules/areadlink
@@ -7,6 +7,7 @@ lib/areadlink.c
Depends-on:
careadlinkat
+readlink
configure.ac:
@@ -20,4 +21,4 @@ License:
LGPLv2+
Maintainer:
-Bruno Haible, Jim Meyering
+Paul Eggert, Bruno Haible, Jim Meyering
diff --git a/modules/careadlinkat b/modules/careadlinkat
index b4bc4a4..35fe049 100644
--- a/modules/careadlinkat
+++ b/modules/careadlinkat
@@ -7,7 +7,6 @@ lib/careadlinkat.h
Depends-on:
allocator
-readlink
ssize_t
unistd
--
1.7.11.7
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] careadlinkat: stop exporting careadlinkatcwd,
Paul Eggert <=