bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler warning in glob


From: Bruno Haible
Subject: Re: Compiler warning in glob
Date: Wed, 26 Dec 2007 16:28:45 +0100
User-agent: KMail/1.5.4

Paul Eggert wrote:
> 2007-10-16  Paul Eggert  <address@hidden>
> 
>       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  <address@hidden>
> 
>       * lib/glob.c: Reimplement link_exists_p to use fstatat64.
> 
>       * lib/glob.c: Add some branch prediction throughout.
> 
>       2007-10-07  Ulrich Drepper  <address@hidden>
> 
>       [BZ #5103]
>       * lib/glob.c (glob): Recognize patterns starting \/.
> 
>       2007-02-14  Jakub Jelinek  <address@hidden>
> 
>       [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  <address@hidden>
> 
>       * lib/glob.c (glob_in_dir): Add some comments and asserts to
>       explain why there are no leaks.
> 
>       2006-09-25  Jakub Jelinek  <address@hidden>
> 
>       [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  <address@hidden>

        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;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]