From: Kristaps Dzonsons <kristaps@bsd.lv>
To: tech@mdocml.bsd.lv
Cc: Ingo Schwarze <schwarze@usta.de>, uqs@spoerlein.net
Subject: Re: Logic error in mandoc.c time2a()
Date: Mon, 14 Mar 2011 18:06:54 +0100 [thread overview]
Message-ID: <4D7E4B2E.5090400@bsd.lv> (raw)
In-Reply-To: <20110312015914.GB12289@iris.usta.de>
> + p = buf = mandoc_malloc(10 + 4 + 4 + 1);
>
> - if (0 == (nsz = strftime(p, rsz, "%B ",&tm)))
> - return(NULL);
> -
> - p += (int)nsz;
> - rsz -= nsz;
> -
> - if (-1 == (isz = snprintf(p, rsz, "%d, ", tm.tm_mday)))
> - return(NULL);
> + if (0 == (ssz = strftime(p, 10 + 1, "%B ",&tm)))
> + goto fail;
> + p += (int)ssz;
>
> + if (-1 == (isz = snprintf(p, 4 + 1, "%d, ", tm.tm_mday)))
> + goto fail;
> p += isz;
> - rsz -= isz;
>
> - return(strftime(p, rsz, "%Y",&tm) ? buf : NULL);
> + if (0 == strftime(p, 4 + 1, "%Y",&tm))
> + goto fail;
> + return(buf);
> +
> +fail:
> + free(buf);
> + return(NULL);
Ingo,
I'm fine with the motion of this diff, but please thoroughly document
the numbers in this before you commit. Yes, they're clear upon
inspection, but I want more in there than 10 + 4 + 4 + 1... But given
this, ok kristaps.
Thanks!
Kristaps
--
To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv
prev parent reply other threads:[~2011-03-14 17:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20110311204204.GA85668@acme.spoerlein.net>
[not found] ` <20110312002738.GA12289@iris.usta.de>
2011-03-12 1:59 ` Ingo Schwarze
2011-03-14 17:06 ` Kristaps Dzonsons [this message]
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=4D7E4B2E.5090400@bsd.lv \
--to=kristaps@bsd.lv \
--cc=schwarze@usta.de \
--cc=tech@mdocml.bsd.lv \
--cc=uqs@spoerlein.net \
/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).