Re: pg_archivecleanup bug
От | Bruce Momjian |
---|---|
Тема | Re: pg_archivecleanup bug |
Дата | |
Msg-id | 20140319180250.GD16122@momjian.us обсуждение исходный текст |
Ответ на | Re: pg_archivecleanup bug (Heikki Linnakangas <hlinnakangas@vmware.com>) |
Ответы |
Re: pg_archivecleanup bug
|
Список | pgsql-hackers |
On Wed, Mar 19, 2014 at 09:59:19AM +0200, Heikki Linnakangas wrote: > >Would people accept? > > > > for (errno = 0; (dirent = readdir(dir)) != NULL; errno = 0) > > > >That would keep the errno's together and avoid the 'continue' additions. > > That's clever. A less clever way would be: > > for (;;) > { > errno = 0; > if ((dirent = readdir(dir)) != NULL) > break; > > ... > } > > I'm fine with either, but that's how I would naturally write it. > > Yet another way would be to have a wrapper function for readdir that > resets errno, and just replace the current readdir() calls with > that. > > And now that I look at initdb.c, walkdir is using the comma > expression for this already. So there's some precedence, and it > doesn't actually look that bad. So I withdraw my objection for that > approach; I'm fine with any of the discussed alternatives, really. OK, let's go with the comma. Ironically, the for() loop would be an odd way to avoid commas as 'for' uses commas often: for (i = 0, j = 1; i < 10; i++, j++) The attached patch is slightly updated. I will apply it to head and all the back branches, including the stylistic change to pg_resetxlog (for consistency) and remove the MinGW block in head. -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. +
Вложения
В списке pgsql-hackers по дате отправления: