Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpJIq-0000Wo-1O for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 19:14:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dpJIp-0003jh-HA for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 19:14:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dpJHH-0000yb-Mj for pgsql-hackers@postgresql.org; Tue, 05 Sep 2017 19:12:51 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dpJHA-0001qj-95 for pgsql-hackers@postgresql.org; Tue, 05 Sep 2017 19:12:51 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id EF6DA20C01; Tue, 5 Sep 2017 15:12:42 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Tue, 05 Sep 2017 15:12:42 -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=fqo4rqg2dR07JoeuLRCq+2dPZRCcY0QALh4iBj9W6BA=; b=RzQc9sfv 43NcowYuJMFDs7oRQowziZjkNrFmrkPm5jDGYpE9zgEcPKkmAO6cfCncGAHGdwZV dmbC7VCtc8vAEGyt7X0X5e0ITaA/Ozy0hpI+OE89r1gK58kMJdJcHaBx5IwAGXyM DRkSthBYc1cSy0+x8WQhn1ITeotesETGIDfiZs0LTKTaJfGdX9zA0uyrlOo5Ce8O HQDJnXkQ6+QMTpqubNi+C6pFUvhOBWabu3tBf5oXvISrQ7nuUIiwzgUqdtZLkFEZ 74K15dqNQg3wMMATrKqu6b1fZIflkzpJ559/H/Q3Dj0t3UsePc7mX54uh4MtKE78 uT75FRnjJwc14w== X-ME-Sender: X-Sasl-enc: UgqV/KAt3MQY+90xvygZyTWN5TtptLtiAB3sztBxXA32 1504638762 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 954CC7FA78; Tue, 5 Sep 2017 15:12:42 -0400 (EDT) Subject: Re: assorted code cleanup To: Michael Paquier References: <2beab0ef-69f9-dab3-cacd-8fdf417bca96@2ndquadrant.com> Cc: pgsql-hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Tue, 5 Sep 2017 15:12:41 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 8/21/17 01:11, Michael Paquier wrote: >> - Drop excessive dereferencing of function pointers > > - (*next_ProcessUtility_hook) (pstmt, queryString, > + next_ProcessUtility_hook(pstmt, queryString, > context, params, queryEnv, > dest, completionTag); > But this... Personally I like the current grammar which allows one to > make the difference between a function call with something declared > locally and something that may be going to a custom code path. So I > think that you had better not update the system hooks that external > modules can use via shared_preload_libraries. Do you mean specifically the hook variables, or any function pointers? I can see your point in the above case, but for example here - if ((*tinfo->f_lt) (o.upper, c.upper, flinfo)) + if (tinfo->f_lt(o.upper, c.upper, flinfo)) I think there is no loss of clarity and the extra punctuation makes it more complicated to read. >> - Remove unnecessary parentheses in return statements > > So you would still keep parenthesis like here for simple expressions: > contrib/bloom/blutils.c: return (x - 1); > No objections. > > Here are some more: > contrib/intarray/_int_bool.c: return (calcnot) ? > contrib/ltree/ltxtquery_op.c: return (calcnot) ? > > And there are many "(0)" "S_ANYTHING" in src/interfaces/ecpg/test/ and > src/interfaces/ecpg/preproc/. Thanks, I included these. >> - Remove our own definition of NULL > > Fine. c.h uses once NULL before enforcing its definition. Actually, that would have worked fine, because the earlier use is a macro definition, so NULL would not have been needed until it is used. >> - fuzzystrmatch: Remove dead code > > Those are remnants of a323ede, which missed to removed everything. Good reference, makes sense. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers