[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compiler warning in glob
From: |
Ralf Wildenhues |
Subject: |
Re: Compiler warning in glob |
Date: |
Mon, 22 Oct 2007 22:18:07 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Hello Paul,
* Paul Eggert wrote on Wed, Oct 17, 2007 at 01:41:21AM CEST:
>
> That bug isn't in the libc version. At this point it's probably better
> to sync the gnulib version from libc, so I installed this:
>
> 2007-10-16 Paul Eggert <address@hidden>
>
> Merge glibc changes into lib/glob.c.
[...]
> + memory_error:
> + while (1)
> + {
> + struct globnames *old = names;
> + for (size_t i = 0; i < cur; ++i)
That doesn't look like C89 to me.
> + free (names->name[i]);
[...]
> + 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];
This patch should fix the C89 issues. Should I report this upstream?
Cheers,
Ralf
2007-10-22 Ralf Wildenhues <address@hidden>
* lib/glob.c: Work for C89.
diff --git a/lib/glob.c b/lib/glob.c
index 1d31d77..7e409d6 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -1442,8 +1442,9 @@ glob_in_dir (const char *pattern, const char *directory,
int flags,
memory_error:
while (1)
{
+ size_t i;
struct globnames *old = names;
- for (size_t i = 0; i < cur; ++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
@@ -1467,8 +1468,9 @@ glob_in_dir (const char *pattern, const char *directory,
int flags,
{
while (1)
{
+ size_t i;
struct globnames *old = names;
- for (size_t i = 0; i < cur; ++i)
+ for (i = 0; i < cur; ++i)
new_gl_pathv[pglob->gl_offs + pglob->gl_pathc++]
= names->name[i];
names = names->next;