Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvkbr-00032K-Qi for pgsql-committers@arkaria.postgresql.org; Wed, 05 Apr 2017 13:04:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cvkbr-0004kd-D8 for pgsql-committers@arkaria.postgresql.org; Wed, 05 Apr 2017 13:04:27 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cvkbr-0004kU-20 for pgsql-committers@postgresql.org; Wed, 05 Apr 2017 13:04:27 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cvkbk-0002xB-HL for pgsql-committers@postgresql.org; Wed, 05 Apr 2017 13:04:25 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id CF4992097C; Wed, 5 Apr 2017 09:04:19 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 05 Apr 2017 09:04:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=1biHPSPti2bvyw2UCXJFSqHpFJmMwBskgcOUPle8Mdc=; b=UDy7H9TO zp/jws4aNWRi535Lxa5rRPgS19pn573kiFGTeTKfFjLS4qLWtgyBAbj/aex8ib34 IgdueT2gA3D5VxJK/T5a9SmN/8hZ+QUg8vRWhSWuQOQpqf95tUM4WjpVtBX5kUTH vqARVJ+WLzNi7x3YKKWXjJPMw57GqKVh9inJrYUFmFcuPSQY2WZ3wod6RfnSkTCD p/EToW4JpGLviAHfx9lWNgDLYZr+KpfEv+qdMCqiKxY8fWrwExqEgM+tfM9e9KFO ol75TZT7uU7XIwquOIRWfWUlQFFCqRIC7PWSI0EMScvHCPtaI6AISIlvYRqBpaVD cRC+7qxqezViHA== X-ME-Sender: X-Sasl-enc: MGyltxlfz7mlld49MLevYCXxKpYclxzKg0te1JpFtd1T 1491397459 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 7C9F6244D9; Wed, 5 Apr 2017 09:04:19 -0400 (EDT) Subject: Re: pgsql: dblink: Replace some macros by static functions To: Tom Lane References: <45e87bd8-6840-7249-73fa-4238a634c6c9@2ndquadrant.com> <30881.1489435086@sss.pgh.pa.us> Cc: David Rowley , pgsql-committers@postgresql.org From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Wed, 5 Apr 2017 09:04:21 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <30881.1489435086@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 3/13/17 15:58, Tom Lane wrote: > In the same vein, I think this bit in dblink_open is pretty poor coding > practice: > > if (!rconn || !rconn->conn) > dblink_conn_not_avail(conname); > else > conn = rconn->conn; > > as it expects both the compiler and the reader to understand that > we will not proceed without "conn" getting a value. I see that > that was band-aided around by initializing conn to NULL, but that's a > crummy way of suppressing uninitialized-variable warnings, because it > will mask even actual errors. Far better would be to remove the dummy > initialization and write > > if (!rconn || !rconn->conn) > dblink_conn_not_avail(conname); > conn = rconn->conn; fixed -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers