Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nYzOZ-0001HW-AP for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Mar 2022 00:07:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nYzOX-0006FQ-6Q for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Mar 2022 00:07:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nYzOW-0006FG-T0 for pgsql-hackers@lists.postgresql.org; Tue, 29 Mar 2022 00:07:32 +0000 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nYzOT-00076P-Q1 for pgsql-hackers@postgresql.org; Tue, 29 Mar 2022 00:07:31 +0000 Received: by mail-il1-x12b.google.com with SMTP id j15so11219635ila.13 for ; Mon, 28 Mar 2022 17:07:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=AgPt+fSe5itqasv85zAQTKiYQ2HgTDSTa70nloRjPq4=; b=vC7MmhPk+SErb3bAkkTxpeWT9a8Fk/FnWXrOtH50x0XZ/QXrLw5KczknyNxx7cFC6S PJrBFmn14x07l2YUXvikH08coXw9m7hwjR/fcHrWKCs78l3PmDGxIkoVMChJ+58YMAUN E8SRAI+2fK+DeIaBjFDHlRGo+FCQQ+VoGNjvbk591+HQVnPcgcrf0nkL8WkbIERsufqr wNM9ue364xA5mZLxy3R33JNu4w2AWlLbgRxo5gEWkesfQoeXDiOPi88ZBHYLDG13h7Fo bd80OE7BJreiDlV2w6KmLoGLPHys02TE9/oyoVhtRGPTdLrT7BqU6Rs1PqohongBq2Ap WeEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=AgPt+fSe5itqasv85zAQTKiYQ2HgTDSTa70nloRjPq4=; b=ZoCIw87fnt9WoZ0OTQ0Cznkzn0cR+1PspylXo3zTV68MItvYDE9y07CvU6Dye50c6m NOIuh9FDtGKJpHDJ+zq5FVnlnzWSNigDXbQgGPQjWpYK1IlQnYhQRf+1F/Yw78xuAwp1 n2eanugTDX/Dan9U0kLEngyVUw+TcF1uvoLpChRgUpU+zVlSbxk6IhI/HAhd/hT81ERV HhPBtWam3RvdLmBM91s9jC4UNpckAMbJxz3/0MJ8vto68IT5Aiqg9vyUsMoY31gfSnyW KV/+4a1QnNcCDT+CRLlhMqaMA9qhUAJHPI72+2kLbt9us7jwhimclJ1CHYI7j2QtEP9V VbAA== X-Gm-Message-State: AOAM531qraijGxxLrmDRWYq3ZNAvH9Of3QiQqcDESt6ewNIOyCfsAPwo lxWykrnTs4+PADrOjBzh4/W8lw== X-Google-Smtp-Source: ABdhPJxcp5GIODMAOxHgRkJ10Fha7l8LRClTl9f40o0iWKu81nbv43JZPhV4WVq8YwVJbcKN53OauQ== X-Received: by 2002:a92:cdad:0:b0:2c6:7b76:a086 with SMTP id g13-20020a92cdad000000b002c67b76a086mr7468630ild.5.1648512449090; Mon, 28 Mar 2022 17:07:29 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id y6-20020a056e02174600b002c7f247b3a7sm8799323ill.54.2022.03.28.17.07.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Mar 2022 17:07:28 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id D6E388008B3; Mon, 28 Mar 2022 19:07:27 -0500 (CDT) Date: Mon, 28 Mar 2022 19:07:27 -0500 From: Justin Pryzby To: Robert Haas Cc: Tom Lane , Dagfinn Ilmari =?iso-8859-1?Q?Manns=E5ker?= , Dipesh Pandit , Andres Freund , Jeevan Ladhe , Alvaro Herrera , "Shinoda, Noriyoshi (PN Japan FSIP)" , Abhijit Menon-Sen , Dmitry Dolgov <9erthalion6@gmail.com>, Jeevan Ladhe , Mark Dilger , pgsql-hackers@postgresql.org, tushar Subject: Re: refactoring basebackup.c (zstd workers) Message-ID: <20220329000727.GV28503@telsasoft.com> References: <20220321131833.GB28503@telsasoft.com> <20220321182256.GC28503@telsasoft.com> <871qyvrvvm.fsf@wibble.ilmari.org> <384291.1648403267@sss.pgh.pa.us> <20220328205329.GT28503@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 28, 2022 at 05:39:31PM -0400, Robert Haas wrote: > On Mon, Mar 28, 2022 at 4:53 PM Justin Pryzby 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 ?