Mercurial > hg > octave-nkf > gnulib-hg
diff lib/glob.c @ 6949:96af1224c6fa
* backupfile.c, dirfd.h, fts.c, getcwd.c, glob.c, glob_.h:
Ignore the obsolescent !HAVE_DIRENT_H case. Consolidate NAMLEN
macros into the GNU _D_EXACT_NAMLEN.
* savedir.c: Likewise.
(savedirstream): Use _D_EXACT_NAMLEN in preference to strlen.
* backupfile.m4, d-ino.m4, d-type.m4, dirfd.m4, fts.m4, getcwd.m4:
* savedir.m4:
Ignore the obsolescent !HAVE_DIRENT_H case. Consolidate NAMLEN
macros into the GNU _D_EXACT_NAMLEN.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 11 Jul 2006 06:02:51 +0000 |
parents | d68ff786c180 |
children | f9276a8d45a7 |
line wrap: on
line diff
--- a/lib/glob.c +++ b/lib/glob.c @@ -47,20 +47,12 @@ # define __set_errno(val) errno = (val) #endif -#if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__ -# include <dirent.h> -# define NAMLEN(dirent) strlen((dirent)->d_name) -#else -# define dirent direct -# define NAMLEN(dirent) (dirent)->d_namlen -# include <ndir.h> -#endif +#include <dirent.h> /* In GNU systems, <dirent.h> defines this macro for us. */ -#ifdef _D_NAMLEN -# undef NAMLEN -# define NAMLEN(d) _D_NAMLEN(d) +#ifndef _D_EXACT_NAMLEN +# define _D_EXACT_NAMLEN(dirent) strlen ((dirent)->d_name) #endif /* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available @@ -86,13 +78,6 @@ /* If the system has the `struct dirent64' type we use it internally. */ #if defined _LIBC && !defined COMPILE_GLOB64 -# if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__ -# define CONVERT_D_NAMLEN(d64, d32) -# else -# define CONVERT_D_NAMLEN(d64, d32) \ - (d64)->d_namlen = (d32)->d_namlen; -# endif - # if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__ # define CONVERT_D_INO(d64, d32) # else @@ -109,7 +94,6 @@ # define CONVERT_DIRENT_DIRENT64(d64, d32) \ memcpy ((d64)->d_name, (d32)->d_name, NAMLEN (d32) + 1); \ - CONVERT_D_NAMLEN (d64, d32) \ CONVERT_D_INO (d64, d32) \ CONVERT_D_TYPE (d64, d32) #endif