From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.rz.uni-karlsruhe.de (Debian-exim@smtp1.rz.uni-karlsruhe.de [129.13.185.217]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id p04069WH004881 for ; Mon, 3 Jan 2011 19:06:10 -0500 (EST) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by smtp1.rz.uni-karlsruhe.de with esmtp (Exim 4.63 #1) id 1PZuPe-0003Zc-By; Tue, 04 Jan 2011 01:06:07 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1PZuPe-0002tC-AN for tech@mdocml.bsd.lv; Tue, 04 Jan 2011 01:06:06 +0100 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.69) (envelope-from ) id 1PZuPe-0004oi-9N for tech@mdocml.bsd.lv; Tue, 04 Jan 2011 01:06:06 +0100 Received: from schwarze by usta.de with local (Exim 4.72) (envelope-from ) id 1PZuPe-0002EE-8W for tech@mdocml.bsd.lv; Tue, 04 Jan 2011 01:06:06 +0100 Date: Tue, 4 Jan 2011 01:06:06 +0100 From: Ingo Schwarze To: tech@mdocml.bsd.lv Subject: Re: [PATCH] partial cleanup of mdoc(7) arg count validation Message-ID: <20110104000606.GC11029@iris.usta.de> References: <20110102211552.GB21085@iris.usta.de> <4D20EFA4.6090409@bsd.lv> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D20EFA4.6090409@bsd.lv> User-Agent: Mutt/1.5.21 (2010-09-15) Hi Kristaps, > These look fine by me, as the ERROR->WARN downgrade doesn't effect a > semantic difference. Thanks, these are in. > In general I encourage two functions instead of one (e.g., checking > whether an argument exist (1) and checking whether it's bool (2)) to > avoid code duplication. If your way doesn't bloat the code any, > however, I'm not opposed to it. No, it doesn't bloat. With two functions, we typically have: * an entry in the function table * an xwarn_opN() wrapper function * that one just calls check_count() and returns (one line) * the main post_macro() validator function With one function (in the cases where i removed the second function), we have: * one fewer entry in the function table * sometimes the wrapper could be deleted completely * one additional line to call check_count() from post_macro() What would bloat the code would be to introduce a new post_macro() function just to call check_count() a few times, but i didn't do that. Yours, Ingo -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv