tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: tech@mdocml.bsd.lv
Subject: Re: [PATCH] partial cleanup of mdoc(7) arg count validation
Date: Tue, 4 Jan 2011 01:06:06 +0100	[thread overview]
Message-ID: <20110104000606.GC11029@iris.usta.de> (raw)
In-Reply-To: <4D20EFA4.6090409@bsd.lv>

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

  reply	other threads:[~2011-01-04  0:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-02 21:15 Ingo Schwarze
2011-01-02 21:35 ` Kristaps Dzonsons
2011-01-04  0:06   ` Ingo Schwarze [this message]
2011-01-20 20:22     ` [PATCH] remaining " Ingo Schwarze
2011-01-21 18:31       ` Kristaps Dzonsons
2011-01-22 16:08         ` better explain roff(7) macro argument quoting Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110104000606.GC11029@iris.usta.de \
    --to=schwarze@usta.de \
    --cc=tech@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).