Jim Meyering [Wed, 22 Nov 2006 23:48:30 +0000 (23:48 +0000)]
Work around a compile-time error from the HP-UX 11.00 /bin/cc.
* lib/fts.c (enum Fts_stat): Give this previously-anon enum a name.
(fts_read): Use a temporary to narrow the overused st_size member
before using it in a switch statement. Reported by Matthew Woehlke.
Jim Meyering [Mon, 20 Nov 2006 23:33:31 +0000 (23:33 +0000)]
The beginnings of syntax-related checks for gnulib.
* lib/Makefile: New file.
* lib/t-idcache: New script. Ensure that the two halves of
idcache.c stay in sync.
Paul Eggert [Mon, 20 Nov 2006 22:01:30 +0000 (22:01 +0000)]
* lib/openat.h (rpl_fstatat): New macro, if
[HAVE_OPENAT && ! LSTAT_FOLLOWS_SLASHED_SYMLINK.
(fstatat): Define to rpl_fstatat under the same conditions,
unless COMPILING_FSTATAT.
* m4/openat.m4 (gl_FUNC_OPENAT): Compile fstatat.c too, if fstatat
seems to have the bug.
* lib/fstatat.c: New file.
* modules/openat (Files): Add it.
Jim Meyering [Mon, 20 Nov 2006 10:54:06 +0000 (10:54 +0000)]
* lib/idcache.c: Restore most of the 2006-11-06 patch, so as to
continue using the flexible array member (thus, this module performs
half as many malloc calls), with the addition that...
(getgroup, getuser): Consistently record a non-match via an empty
"name" string, and map an empty string match to a NULL return value.
* modules/idcache (Depends-on): Re-add flexmember.
Paul Eggert [Mon, 20 Nov 2006 09:10:18 +0000 (09:10 +0000)]
* lib/idcache.c: Undo most recent patch, dated 2006-11-06.
It mishandled the case where the group was missing.
Problem reported by Greg Schafer.
* modules/idcache: Likewise.
Bruno Haible [Wed, 15 Nov 2006 20:50:54 +0000 (20:50 +0000)]
No need to invoke gl_FUNC_ALLOCA more than once. But using AC_REQUIRE would
be wrong here, since gl_FUNC_ALLOCA calls AC_FUNC_ALLOCA which has an effect
on @ALLOCA@.
Ralf Wildenhues [Tue, 14 Nov 2006 22:01:14 +0000 (22:01 +0000)]
* MODULES.html.sh (seen_modules, seen_files): New variables.
(func_module): Rewrite to use a few less gnulib-tool and sed
invocations. Avoid a couple of quadratic algorithms for ...
(missed_modules, missed_files): ... these, with ...
(func_append, func_tmpdir): ... these new functions, from
gnulib-tool. Analogously, install traps for cleanup.
Bruno Haible [Mon, 13 Nov 2006 19:07:29 +0000 (19:07 +0000)]
Override also AC_LIBSOURCES. Works around an automake error
"automatically discovered file `error.c' should not be explicitly mentioned"
in some circumstances.
Jim Meyering [Sun, 12 Nov 2006 17:35:38 +0000 (17:35 +0000)]
Make fts (in FTS_CWDFD mode) more efficient by caching a few open
file descriptors. This also averts a failure on systems with
native openat support when a traversed directory lacks "x" access.
* lib/fts_.h: Include "i-ring.h"
(struct FTS) [fts_fd_ring]: New member.
* lib/fts.c (RESTORE_INITIAL_CWD): Also call fd_ring_clear.
(FCHDIR): Add parentheses.
(fd_ring_check, fd_ring_print) [!FTS_DEBUG]: Define away.
(cwd_advance_fd): Add a 3rd parameter. Adjust all callers.
When descending, rather than simply closing the previous
fts_cwd_fd value, push that file descriptor onto the ring.
(same_fd, fd_ring_print, fd_ring_check) [FTS_DEBUG]: New functions.
(fts_open): Initialize the new fd_ring member.
(fts_close): Clear the ring.
(fts_safe_changedir): When possible, use our new fd_ring to skip
the diropen and fstat and dev/ino comparison that would normally
accompany a virtual `chdir ("..")'.
* modules/fts (Depends-on): Add i-ring.
* modules/i-ring: New module.
* lib/i-ring.c, lib/i-ring.h, lib/i-ring-test.c: New files.
* m4/i-ring.m4: New file.
Ralf Wildenhues [Sun, 12 Nov 2006 09:53:16 +0000 (09:53 +0000)]
* gnulib-tool (func_create_testdir): Fix replacement of
`build-aux' in configure.ac. Run autotools in gltests
subdirectory.
(func_create_testdir, func_create_megatestdir, test): There is
no need for '--force' in most autotool invocations in a new
tree. Actually fail the whole test if any of the tools, or the
configure or make stages fail.
Ralf Wildenhues [Sun, 12 Nov 2006 09:50:10 +0000 (09:50 +0000)]
Sync from Automake.
* build-aux/gnupload: Revert last change. Add pointer to upload
instructions of the GNU Maintenance Instructions.
Suggestion by Karl Berry.
Paul Eggert [Wed, 8 Nov 2006 20:13:12 +0000 (20:13 +0000)]
* lib/quotearg.h (quotearg_free): New decl.
* lib/quotearg.c (quotearg_free): New function.
(slot0, nslots, slotvec0, slotvec):
Now file-scope so that quotearg_free can get at them.
Paul Eggert [Wed, 8 Nov 2006 00:22:30 +0000 (00:22 +0000)]
* lib/xalloc.h (XMALLOC, XNMALLOC, XZALLOC, XCALLOC): Move
definitions up, to avoid colliding with change below.
(static_inline) [HAVE_INLINE]: New macro.
(xnmalloc, xnrealloc, x2nrealloc, xcharalloc):
Provide extern decls when !HAVE_INLINE. Do not define unless
static_inline is defined, either by us or by xmalloc.c. Use
static_inline rather than static inline.
(XCALLOC): Optimize sizeof(T) = 1 case.
* lib/xmalloc.c (static_inline) [!HAVE_INLINE]: New macro.
Paul Eggert [Mon, 6 Nov 2006 22:02:53 +0000 (22:02 +0000)]
* lib/idcache.c: Include <stddef.h>, for offsetof.
(struct userid.name): Change from char * to a flexible array member.
All uses changed.
* modules/idcache (Depends-on): Add flexmember.
Paul Eggert [Mon, 6 Nov 2006 21:38:27 +0000 (21:38 +0000)]
* m4/xalloc.m4 (gl_PREREQ_XMALLOC): Remove AC_C_INLINE since
xmalloc.c no longer uses inline directly. gl_PREREQ_XALLOC now
captures the dependency in AC_C_INLINE.
Paul Eggert [Mon, 6 Nov 2006 21:24:35 +0000 (21:24 +0000)]
* lib/xalloc.h (xnmalloc, xnrealloc, x2nrealloc): Now static
inline functions that are identical with the old xnmalloc_inline,
xnrealloc_inline, x2nrealloc_inline of lib/xmalloc.c. This is so
that we can avoid some unnecessary integer multiplications and
divisions in the common case where the element size is known at
compile time.
(XNMALLOC) [HAVE_INLINE]: Remove special case, which is no longer
needed.
(xnboundedmalloc): Remove.
(XMALLOC, XNMALLOC, XZALLOC, XCALLOC): Use lower-case letters for
arguments, for consistency with rest of this header.
(xcharalloc): Rewrite using XNMALLOC.
* lib/xmalloc.c (xnmalloc_inline, xnmalloc, xnrealloc_inline):
(xnrealloc, x2nrealloc_inline, x2nrealloc): Remove. The *_inline
versions have been moved to lib/xalloc.h and renamed to be the
non-*_inline versions.
(xmalloc, xrealloc): Implement without reference to the xnmalloc
and xnrealloc functions, since those functions are now inline and
now call us.
(x2realloc): Invoke x2realloc, not x2realloc_inline, to accommodate
renaming described above.
Paul Eggert [Mon, 6 Nov 2006 18:21:34 +0000 (18:21 +0000)]
* MODULES.html.sh (File system functions): New module
canonicalize-lgpl.
* lib/canonicalize.h: Add comments for canonicalize_filename_mode
and canonicalize_file_name.
* lib/canonicalize-lgpl.c, m4/canonicalize-lgpl.m4:
* modules/canonicalize-lgpl: New files.
Paul Eggert [Fri, 3 Nov 2006 23:17:27 +0000 (23:17 +0000)]
* lib/canonicalize.h: (canonicalize_mode_t, CAN_EXISTING):
(CAN_ALL_BUT_LAST, CAN_MISSING, canonicalize_filename_mode):
Define only if PROVIDE_CANONICALIZE_FILENAME_MODE is defined.
* m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
Check for functions and headers just once.
Check for declaration of canonicalize_file_name.
Define PROVIDE_CANONICALIZE_FILENAME_MODE.
Paul Eggert [Tue, 31 Oct 2006 21:51:45 +0000 (21:51 +0000)]
Avoid some C++ diagnostics reported by Bruno Haible.
* lib/quotearg.c (clone_quoting_options): Use xmemdup rather than
xmalloc.
(quotearg_alloc): Use xcharalloc rather than xmalloc.
(struct slotvec): Move to top level.
(quotearg_n_options): Rewrite to avoid xmalloc.
* lib/xalloc.h (xcharalloc): New function.
* (xrealloc, xnrealloc, x2realloc, x2nrealloc, xmemdup):
[defined __cplusplus]: Add function template that provides result
type propagation. This part of the change is from Bruno Haible.