[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] New GNULIB glob module?
From: |
Paul Eggert |
Subject: |
Re: [bug-gnulib] New GNULIB glob module? |
Date: |
Sat, 14 May 2005 13:52:46 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) |
Derek Price <address@hidden> writes:
> /* Enable GNU extensions in glob.h. */
> -#ifndef _GNU_SOURCE
> +#if defined _LIBC && !defined _GNU_SOURCE
> # define _GNU_SOURCE 1
> #endif
I just checked the glibc source file include/libc-symbols.h, and it
defines both _LIBC and _GNU_SOURCE. So this stuff isn't needed at
all; please remove these lines from glob.c instead.
> + HAVE_STRUCT_DIRENT_D_TYPE is defined by GNULIB's glob.m4 when the same
> + member is found. */
A bit wordy; please rephrase to "HAVE_STRUCT_DIRENT_D_TYPE plays the
same rule in gnulib."
> - qsort ((__ptr_t) &pglob->gl_pathv[oldcount],
> + qsort ((void *) &pglob->gl_pathv[oldcount],
You can remove the cast entirely, right?
> - free ((__ptr_t) pglob->gl_pathv[pglob->gl_offs + i]);
> - free ((__ptr_t) pglob->gl_pathv);
> + free ((void *) pglob->gl_pathv[pglob->gl_offs + i]);
> + free ((void *) pglob->gl_pathv);
Similarly, these casts aren't needed.
- free ((__ptr_t) array[--i]);
+ free ((void *) array[--i]);
Nor these.
> - free ((__ptr_t) array[--i]);
> + free ((void *) array[--i]);
Nor this one.
> + p = mempcpy ((void *) new->name, name, len);
Nor this one.
> - free ((__ptr_t) names->name);
> + free ((void *) names->name);
Nor this.
> - return (((flags & GLOB_ALTDIRFUNC)
> - ? (*pglob->gl_stat) (fullname, &st)
> - : __stat64 (fullname, &st64)) == 0);
> + return ((flags & GLOB_ALTDIRFUNC)
> + ? (*pglob->gl_stat) (fullname, &st) == 0 && S_ISDIR (st.st_mode)
> + : __stat64 (fullname, &st64) == 0 && S_ISDIR (st64.st_mode));
As long as you're reparenthesizing you might as well get rid of
the unnecessary ones around (flags & GLOB_ALTDIRFUNC).
> + new->name = malloc (len + 1
> + + ((flags & GLOB_MARK) && isdir));
This line is 80 columns; should probably shrink it to 78, e.g., via.
new->name =
malloc (...);
glob.c is looking pretty good now. I gotta run now, but I'll look at
glob.h later today I hope.
- [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/11
- Re: [bug-gnulib] New GNULIB glob module?, Karl Berry, 2005/05/11
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/11
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/11
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/12
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/13
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/13
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/13
- Re: [bug-gnulib] New GNULIB glob module?,
Paul Eggert <=
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/16
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/15
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/17
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/17
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/14
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/15
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/16
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/17
- Re: [bug-gnulib] New GNULIB glob module?, Paul Eggert, 2005/05/18
- Re: [bug-gnulib] New GNULIB glob module?, Derek Price, 2005/05/18