Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gk9Bm-0008Az-1h for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jan 2019 15:02:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gk9Bj-0005xz-7X for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jan 2019 15:02:35 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gk9Bj-0005xo-0e for pgsql-hackers@lists.postgresql.org; Thu, 17 Jan 2019 15:02:35 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gk9BU-0001Ew-9X for pgsql-hackers@postgresql.org; Thu, 17 Jan 2019 15:02:34 +0000 Received: by mail-qt1-x841.google.com with SMTP id d19so11567402qtq.9 for ; Thu, 17 Jan 2019 07:02:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=wX2KSipfFm8SGjWEgep6tdmJQlN5BNjG1YvkK4xpXEU=; b=Y3tq+AsjwhMMwc8SJN0VGwaeEjT0J190LFSQaHfX7MLievD8vTA3dcSAzEsr3Np8J9 uW+NaIagqbvn2L+P8swfDMqZeZz+FIClcMJAlVXWRN66AATxvdzTYV47OGhysbjWPANK KObguc8+6ZtndhxtnSe+Ft4EhKnqxAhnYocBqzbG20nwYdt99lWcR6myDaRFxS77uTC2 UHaLM7m/tkJUCZFxknPM3qYtsg1YYVwBcE1QgM4b5YpK/myJZ++Qct2Uxp1uyHoifHdf MRF7b5O4gHEEBqz4O34fhQaqv0YPNT+oWF9mXqE9WxkINkc52jOvs4pHrt43QYX95tTv HPkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=wX2KSipfFm8SGjWEgep6tdmJQlN5BNjG1YvkK4xpXEU=; b=Lrb5ehpdEok7J2HolRZB7QDBfgrD23IqM2y81t3kS6Zn9wmGJfAKOYh3yb6jqxrml8 B5cjjzWM8shEdKl+vcci0ldDN99Yukdzs4GzKiYP5Vtqc51Dos0c2R180SI+sxBb8NNk Y4L0XMN2p/o/FklCg4RtjSU3FeGHrl07G4DvT8d6QSroIwKBYL7iueRCXA8Cz/ag/Ebq PJlz2ahU5RPhx9C5jiJdjTOvHlqZogip5U7IcrF/ba7WKTqoeqoBX8hnR4/ITsDahl3c yFQaFd4++N5irjbYxk1N188PyEyaS0hob9k+5BSl1L87Ep7Hu4fPD58IcftQu2X/0pUz SkPg== X-Gm-Message-State: AJcUukcgZOia/xpejpco6Sa864nsruGPG+fsjq93e5/Oq0b+Ug5TR5FM Zsvakg5lQifC+FGy2VxnIwwDoA== X-Google-Smtp-Source: ALg8bN53F1TZbHa6Tep/+oCANfgvjoRwFORqujhq/ObpN03iKu6qz5lLMaY44R7svPIYvB2Q5znOHg== X-Received: by 2002:ac8:788:: with SMTP id l8mr11881724qth.384.1547737338428; Thu, 17 Jan 2019 07:02:18 -0800 (PST) Received: from alvin.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id q184sm41527997qkb.23.2019.01.17.07.02.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jan 2019 07:02:17 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 07936938; Thu, 17 Jan 2019 12:02:16 -0300 (-03) Date: Thu, 17 Jan 2019 12:02:16 -0300 From: Alvaro Herrera To: Dmitry Dolgov <9erthalion6@gmail.com> Cc: PostgreSQL-development Subject: Re: ArchiveEntry optional arguments refactoring Message-ID: <201901171502.nh6krqterjdd@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716-1013-2c1e88 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Jan-16, Dmitry Dolgov wrote: > Proposed idea is to refactor out all/optional arguments into a separate data > structure, so that adding/removing a new argument wouldn't change that much of > unrelated code. Then for every invocation of ArchiveEntry this structure needs > to be prepared before the call, or as Andres suggested: > > ArchiveEntry((ArchiveArgs){.tablespace = 3, > .dumpFn = somefunc, > ...}); Prepping the struct before the call would be our natural style, I think. This one where the struct is embedded in the function call does not look *too* horrible, but I'm curious as to what does pgindent do with it. > Another suggestion from Amit is to have an ArchiveEntry() function with limited > number of parameters, and an ArchiveEntryEx() with those extra parameters which > are not needed in usual cases. Is there real savings to be had by doing this? What would be the arguments to each function? Off-hand, I'm not liking this idea too much. But maybe we can combine both ideas and have one "normal" function with only the most common args, and create ArchiveEntryExtended to use the struct as proposed by Andres. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services