Re: refactoring basebackup.c (zstd workers)

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: refactoring basebackup.c (zstd workers)
Дата
Msg-id 20220329000727.GV28503@telsasoft.com
обсуждение исходный текст
Ответ на Re: refactoring basebackup.c (zstd workers)  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Mon, Mar 28, 2022 at 05:39:31PM -0400, Robert Haas wrote:
> On Mon, Mar 28, 2022 at 4:53 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
> > I suggest to write it differently, as in 0002.
> 
> That doesn't seem better to me. What's the argument for it?

I find this much easier to understand:

                /* If we got an error or have reached the end of the string, stop. */
                                                                                                          
 
-               if (result->parse_error != NULL || *kwend == '\0' || *vend == '\0')
                                                                                                          
 
+               if (result->parse_error != NULL)
                                                                                                          
 
+                       break;
                                                                                                          
 
+               if (*kwend == '\0')
                                                                                                          
 
+                       break;
                                                                                                          
 
+               if (vend != NULL && *vend == '\0')
                                                                                                          
 
                        break;
                                                                                                          
 

than

                /* If we got an error or have reached the end of the string, stop. */
-               if (result->parse_error != NULL || *kwend == '\0' || *vend == '\0')
+               if (result->parse_error != NULL ||
+                       (vend == NULL ? *kwend == '\0' : *vend == '\0'))

Also, why wouldn't *kwend be checked in any case ?



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: Re: [PATCH] Add extra statistics to explain for Nested Loop
Следующее
От: Tom Lane
Дата:
Сообщение: Re: refactoring basebackup.c (zstd workers)