Paul Eggert wrote: > 2007-10-16 Paul Eggert <[EMAIL PROTECTED]> > > Merge glibc changes into lib/glob.c. > > * lib/glob.c (glob_in_dir): Sync with glibc/posix/glob.c, dated > 2007-10-15 04:59:03 UTC. Here are the changes: > > 2007-10-14 Ulrich Drepper <[EMAIL PROTECTED]> > > * lib/glob.c: Reimplement link_exists_p to use fstatat64. > > * lib/glob.c: Add some branch prediction throughout. > > 2007-10-07 Ulrich Drepper <[EMAIL PROTECTED]> > > [BZ #5103] > * lib/glob.c (glob): Recognize patterns starting \/. > > 2007-02-14 Jakub Jelinek <[EMAIL PROTECTED]> > > [BZ #3996] > * lib/glob.c (attribute_hidden): Define if not defined. > (glob): Unescape dirname, filename or username when needed and not > GLOB_NOESCAPE. Handle \/ correctly. Handle GLOB_MARK if filename > is NULL. Handle unescaped [ in pattern without closing ]. > Don't pass GLOB_CHECK down to recursive glob for directories. > (__glob_pattern_type): New function. > (__glob_pattern_p): Implement using __glob_pattern_type. > (glob_in_dir): Handle GLOB_NOCHECK patterns containing no meta > characters and backslashes if not GLOB_NOESCAPE or unterminated [. > Remove unreachable code. > > 2006-09-30 Ulrich Drepper <[EMAIL PROTECTED]> > > * lib/glob.c (glob_in_dir): Add some comments and asserts to > explain why there are no leaks. > > 2006-09-25 Jakub Jelinek <[EMAIL PROTECTED]> > > [BZ #3253] > * lib/glob.c (glob_in_dir): Don't alloca one struct globlink at a > time, rather allocate increasingly bigger arrays of pointers, if > possible with alloca, if too large with malloc.
This does not compile with an ANSI C compiler any more. I'm committing this fix: 2007-12-25 Bruno Haible <[EMAIL PROTECTED]> Fixup after 2007-10-16 commit. * lib/glob.c (glob_in_dir): Don't use ISO C99 syntax. *** lib/glob.c.orig 2007-12-25 07:21:06.000000000 +0100 --- lib/glob.c 2007-12-25 07:20:23.000000000 +0100 *************** *** 1443,1449 **** while (1) { struct globnames *old = names; ! for (size_t i = 0; i < cur; ++i) free (names->name[i]); names = names->next; /* NB: we will not leak memory here if we exit without --- 1457,1464 ---- while (1) { struct globnames *old = names; ! size_t i; ! for (i = 0; i < cur; ++i) free (names->name[i]); names = names->next; /* NB: we will not leak memory here if we exit without *************** *** 1468,1474 **** while (1) { struct globnames *old = names; ! for (size_t i = 0; i < cur; ++i) new_gl_pathv[pglob->gl_offs + pglob->gl_pathc++] = names->name[i]; names = names->next; --- 1483,1490 ---- while (1) { struct globnames *old = names; ! size_t i; ! for (i = 0; i < cur; ++i) new_gl_pathv[pglob->gl_offs + pglob->gl_pathc++] = names->name[i]; names = names->next;