pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: Dipesh Pandit <dipesh.pandit@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Jeevan Ladhe <jeevanladhe.os@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Shinoda, Noriyoshi (PN Japan FSIP) <noriyoshi.shinoda@hpe.com>
Cc: Abhijit Menon-Sen <ams@toroid.org>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>
Cc: Mark Dilger <mark.dilger@enterprisedb.com>
Cc: pgsql-hackers@postgresql.org, tushar <tushar.ahuja@enterprisedb.com>
Subject: Re: refactoring basebackup.c (zstd workers)
Date: Mon, 28 Mar 2022 19:07:27 -0500
Message-ID: <20220329000727.GV28503@telsasoft.com> (raw)
In-Reply-To: <CA+TgmoYw=UFomz2f8Uq0LtUmvcReRFqKb19YwO2O0Wv0Azz_ng@mail.gmail.com>
References: <20220321131833.GB28503@telsasoft.com>
	<CA+TgmoZz-F1pA1Vv=-6FOPWuS1eFi2ifNyySV4u6pW0+FBeG-g@mail.gmail.com>
	<20220321182256.GC28503@telsasoft.com>
	<CA+TgmoYJ=9Y=+fJ9WyAXAExTmpArCZEdRu1iVQ_2je+heTZGrg@mail.gmail.com>
	<871qyvrvvm.fsf@wibble.ilmari.org>
	<CA+Tgmobummc+reyzZJwnua7KXPC9sromDqYx1uoZ49mxq=LRfQ@mail.gmail.com>
	<384291.1648403267@sss.pgh.pa.us>
	<CA+TgmoZ1DbW_nKeVteVvYt0WvZDhm77_qdb-TErjctW+h5_3Jg@mail.gmail.com>
	<20220328205329.GT28503@telsasoft.com>
	<CA+TgmoYw=UFomz2f8Uq0LtUmvcReRFqKb19YwO2O0Wv0Azz_ng@mail.gmail.com>

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 ?





view thread (32+ messages)  latest in thread

Message-ID: <20220329000727.GV28503@telsasoft.com>
Permalink:  ../20220329000727.GV28503@telsasoft.com/
Also on:    postgresql.org/message-id/20220329000727.GV28503@telsasoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, ilmari@ilmari.org, dipesh.pandit@gmail.com, andres@anarazel.de, jeevanladhe.os@gmail.com, alvherre@alvh.no-ip.org, noriyoshi.shinoda@hpe.com, ams@toroid.org, 9erthalion6@gmail.com, jeevan.ladhe@enterprisedb.com, mark.dilger@enterprisedb.com, tushar.ahuja@enterprisedb.com
  Subject: Re: refactoring basebackup.c (zstd workers)
  In-Reply-To: <20220329000727.GV28503@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox