I installed this into gnulib. This is just an internal cleanup; it shouldn't affect behavior.
2005-05-18 Paul Eggert <[EMAIL PROTECTED]> * lib/canonicalize.c: Include canonicalize.h first, to test interface. Include <stddef.h> unconditionally, since we assume C89 now. All uses of PTR_INT_TYPE replaced by ptrdiff_t. * lib/fts.c: Include fts_.h first, to check interface. Do not include intprops.h; no longer needed. Include cycle-check.h and hash.h, since fts_.h no longer does. Remove unnecessary casts of closedir to void. (fts_build): Use a simpler method (not involving TYPE_SIGNED) to decide whether to decrement nlinks. * lib/fts_.h: Do not include hash.h or cycle-check.h; no longer needed. (FTS): Use struct hash_table * instead of Hash_table, so that we no longer need to include hash.h here. * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME]): Don't check for stddef.h. * m4/fts.m4 (gl_FUNC_FTS): Don't require AC_HEADER_STDC, as we don't use its results. Don't check for fcntl.h, stddef.h, stdlib.h, string.h, unistd.h, since we include them unconditionally. Don't require AM_STDBOOL_H, since stdbool is a prerequisite. Don't require AC_C_CONST, AC_TYPE_SIZE_T or check for ptrdiff_t since we assume C89 or better. Don't require AC_FUNC_CLOSEDIR_VOID, AC_FUNC_LSTAT, or AC_FUNC_STAT, as we don't use their results. Don't check for fchdir, memmove, memset, strrchr, as we use them unconditionally. * m4/gettimeofday.m4 (AC_FUNC_GETTIMEOFDAY_CLOBBER): Don't define GETTIMEOFDAY_CLOBBERS_LOCALTIME_BUFFER, since nobody uses it. Index: lib/canonicalize.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/canonicalize.c,v retrieving revision 1.3 diff -p -u -r1.3 canonicalize.c --- lib/canonicalize.c 14 May 2005 06:03:57 -0000 1.3 +++ lib/canonicalize.c 18 May 2005 19:43:49 -0000 @@ -20,6 +20,8 @@ # include <config.h> #endif +#include "canonicalize.h" + #ifdef STDC_HEADERS # include <stdlib.h> #else @@ -43,6 +45,7 @@ void free (); #endif #include <errno.h> +#include <stddef.h> #include "cycle-check.h" #include "path-concat.h" @@ -54,24 +57,6 @@ void free (); # define __set_errno(Val) errno = (Val) #endif -/* If __PTRDIFF_TYPE__ is - defined, as with GNU C, use that; that way we don't pollute the - namespace with <stddef.h>'s symbols. Otherwise, if <stddef.h> is - available, include it and use ptrdiff_t. In traditional C, long is - the best that we can do. */ - -#ifdef __PTRDIFF_TYPE__ -# define PTR_INT_TYPE __PTRDIFF_TYPE__ -#else -# ifdef HAVE_STDDEF_H -# include <stddef.h> -# define PTR_INT_TYPE ptrdiff_t -# else -# define PTR_INT_TYPE long -# endif -#endif - -#include "canonicalize.h" #include "pathmax.h" #include "xreadlink.h" @@ -230,7 +215,7 @@ canonicalize_filename_mode (const char * if (dest + (end - start) >= rpath_limit) { - PTR_INT_TYPE dest_offset = dest - rpath; + ptrdiff_t dest_offset = dest - rpath; size_t new_size = rpath_limit - rpath; if (end - start + 1 > PATH_MAX) Index: lib/fts.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/fts.c,v retrieving revision 1.1 diff -p -u -r1.1 fts.c --- lib/fts.c 17 May 2005 07:07:19 -0000 1.1 +++ lib/fts.c 18 May 2005 19:43:49 -0000 @@ -53,6 +53,8 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #endif /* LIBC_SCCS and not lint */ +#include "fts_.h" + #if HAVE_SYS_PARAM_H || defined _LIBC # include <sys/param.h> #endif @@ -64,9 +66,10 @@ static char sccsid[] = "@(#)fts.c 8.6 (B #include <fcntl.h> #include <errno.h> #include "dirfd.h" -#include "fts_.h" -#include "intprops.h" +#include "cycle-check.h" +#include "hash.h" #include "unistd-safer.h" +#include <stdbool.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -926,7 +929,7 @@ fts_build (register FTS *sp, int type) cur->fts_flags |= FTS_DONTCHDIR; descend = false; cderrno = errno; - (void)closedir(dirp); + closedir(dirp); dirp = NULL; } else descend = true; @@ -976,7 +979,7 @@ mem1: saved_errno = errno; if (p) free(p); fts_lfree(head); - (void)closedir(dirp); + closedir(dirp); cur->fts_info = FTS_ERR; SET(FTS_STOP); __set_errno (saved_errno); @@ -1001,7 +1004,7 @@ mem1: saved_errno = errno; */ free(p); fts_lfree(head); - (void)closedir(dirp); + closedir(dirp); cur->fts_info = FTS_ERR; SET(FTS_STOP); __set_errno (ENAMETOOLONG); @@ -1043,11 +1046,9 @@ mem1: saved_errno = errno; p->fts_info = fts_stat(sp, p, false); /* Decrement link count if applicable. */ - if (nlinks > 0 - && (TYPE_SIGNED (nlink_t) || nostat) - && (p->fts_info == FTS_D || + if (nlinks > 0 && (p->fts_info == FTS_D || p->fts_info == FTS_DC || p->fts_info == FTS_DOT)) - --nlinks; + nlinks -= nostat; } /* We walk in directory order so "ls -f" doesn't get upset. */ @@ -1061,7 +1062,7 @@ mem1: saved_errno = errno; ++nitems; } if (dirp) - (void)closedir(dirp); + closedir(dirp); /* * If realloc() changed the address of the path, adjust the Index: lib/fts_.h =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/fts_.h,v retrieving revision 1.1 diff -p -u -r1.1 fts_.h --- lib/fts_.h 17 May 2005 07:07:19 -0000 1.1 +++ lib/fts_.h 18 May 2005 19:43:49 -0000 @@ -63,8 +63,7 @@ # include <stddef.h> # include <sys/types.h> -# include "hash.h" -# include "cycle-check.h" +# include <sys/stat.h> typedef struct { struct _ftsent *fts_cur; /* current node */ @@ -116,7 +115,7 @@ typedef struct { and promptly even when the depth of a hierarchy is in the tens of thousands. Lazy checking, as done by GNU rm via cycle-check.c, wouldn't be appropriate for du. */ - Hash_table *active_dir_ht; + struct hash_table *active_dir_ht; struct cycle_check_state *cycle_state; } FTS; Index: m4/canonicalize.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/canonicalize.m4,v retrieving revision 1.4 diff -p -u -r1.4 canonicalize.m4 --- m4/canonicalize.m4 2 May 2005 07:00:50 -0000 1.4 +++ m4/canonicalize.m4 18 May 2005 19:43:49 -0000 @@ -1,4 +1,4 @@ -#serial 7 +#serial 8 # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -13,6 +13,6 @@ AC_DEFUN([AC_FUNC_CANONICALIZE_FILE_NAME AC_LIBOBJ([canonicalize]) AC_REQUIRE([AC_HEADER_STDC]) - AC_CHECK_HEADERS(string.h sys/param.h stddef.h) + AC_CHECK_HEADERS(string.h sys/param.h) AC_CHECK_FUNCS(resolvepath canonicalize_file_name) ]) Index: m4/fts.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/fts.m4,v retrieving revision 1.2 diff -p -u -r1.2 fts.m4 --- m4/fts.m4 18 May 2005 18:24:27 -0000 1.2 +++ m4/fts.m4 18 May 2005 19:43:49 -0000 @@ -6,7 +6,7 @@ dnl with or without modifications, as lo AC_DEFUN([gl_FUNC_FTS], [ - AC_LIBSOURCES([fts.c, fts_.h, intprops.h]) + AC_LIBSOURCES([fts.c, fts_.h]) dnl Use this version of fts unconditionally, since the GNU libc and dnl NetBSD versions have bugs and/or unnecessary limitations. @@ -16,21 +16,12 @@ AC_DEFUN([gl_FUNC_FTS], # Checks for header files. AC_REQUIRE([AC_HEADER_DIRENT]) - AC_REQUIRE([AC_HEADER_STDC]) - AC_CHECK_HEADERS_ONCE([fcntl.h inttypes.h stddef.h stdint.h]) - AC_CHECK_HEADERS_ONCE([stdlib.h string.h sys/param.h unistd.h]) + AC_CHECK_HEADERS_ONCE([inttypes.h stdint.h]) + AC_CHECK_HEADERS_ONCE([sys/param.h]) # Checks for typedefs, structures, and compiler characteristics. - AC_REQUIRE([AM_STDBOOL_H]) - AC_REQUIRE([AC_C_CONST]) - AC_REQUIRE([AC_TYPE_SIZE_T]) AC_REQUIRE([gt_INTTYPES_PRI]) - AC_CHECK_TYPES([ptrdiff_t]) # Checks for library functions. - AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID]) - AC_REQUIRE([AC_FUNC_LSTAT]) AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) - AC_REQUIRE([AC_FUNC_STAT]) - AC_CHECK_FUNCS_ONCE([fchdir memmove memset strrchr]) ]) Index: m4/gettimeofday.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/gettimeofday.m4,v retrieving revision 1.9 diff -p -u -r1.9 gettimeofday.m4 --- m4/gettimeofday.m4 23 Jan 2005 08:06:57 -0000 1.9 +++ m4/gettimeofday.m4 18 May 2005 19:43:49 -0000 @@ -1,6 +1,6 @@ -#serial 6 +#serial 7 -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -62,8 +62,6 @@ main () AC_DEFINE(gettimeofday, rpl_gettimeofday, [Define to rpl_gettimeofday if the replacement function should be used.]) - AC_DEFINE(GETTIMEOFDAY_CLOBBERS_LOCALTIME_BUFFER, 1, - [Define if gettimeofday clobbers localtime's static buffer.]) gl_PREREQ_GETTIMEOFDAY fi ]) _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib