[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: portability patch for io/ftw.c
From: |
Ulrich Drepper |
Subject: |
Re: portability patch for io/ftw.c |
Date: |
Fri, 07 Feb 2003 12:41:20 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030203 |
Jim Meyering wrote:
> +#if defined _LIBC
> +# include <dirent.h>
> +# define NAMLEN(dirent) _D_EXACT_NAMLEN(dirent)
> +#else
> +# if HAVE_DIRENT_H || defined _LIBC
> +# include <dirent.h>
> +# define NAMLEN(dirent) strlen ((dirent)->d_name)
> +# else
> +# define dirent direct
> +# define NAMLEN(dirent) (dirent)->d_namlen
This part is not correct.
First, why a || defined _libc in the #else branch?
Second, I doubt you can rely on d_namlen for all platforms without
<dirent.h>. And vice versa: there are platforms which have <dirent.h>
and which define an appropriate field, making the strlen() call unnecessary.
> @@ -49,8 +93,6 @@
> # define __closedir closedir
> # undef __fchdir
> # define __fchdir fchdir
> -# undef __getcwd
> -# define __getcwd getcwd
> # undef __opendir
> # define __opendir opendir
> # undef __readdir64
> @@ -61,6 +103,10 @@
> # define __tfind tfind
> # undef __tsearch
> # define __tsearch tsearch
> +# undef __stpcpy
> +# define __stpcpy stpcpy
> +# undef __mempcpy
> +# define __mempcpy mempcpy
> # undef internal_function
> # define internal_function /* empty */
> # undef dirent64
> @@ -69,6 +115,21 @@
> # define MAX(a, b) ((a) > (b) ? (a) : (b))
> #endif
>
> +#ifndef _LIBC
> +# undef __getcwd
> +# define __getcwd(P, N) xgetcwd ()
> +extern char *xgetcwd (void);
> +#endif
You remove the __getcwd from the first #ifndef _LIBC block just to add
it in a directly following new #ifndef _LIBC block? Please keep the
changes to a minimum.
--
--------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------