From: Ingo Schwarze <schwarze@usta.de>
To: tech@mdocml.bsd.lv
Subject: Re: Remaining patches
Date: Sun, 19 Dec 2010 13:41:16 +0100 [thread overview]
Message-ID: <20101219124116.GC4280@iris.usta.de> (raw)
In-Reply-To: <20101211170714.GG27691@iris.usta.de>
Hi Kristaps,
Ingo Schwarze wrote on Sat, Dec 11, 2010 at 06:07:14PM +0100:
> Gah, that's wrong as well.
> It only moves the bug from sz = 1 to sz = initial-1.
>
> It must be
>
> buf->sz = buf->sz > initial/2 ? 2 * buf->sz : initial;
To get this finally settled:
OK for this one, too?
Or does it still crash your Alpha?
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/main.c,v
retrieving revision 1.61
diff -u -p -r1.61 main.c
--- main.c 9 Dec 2010 23:01:18 -0000 1.61
+++ main.c 19 Dec 2010 12:34:57 -0000
@@ -375,7 +375,7 @@ static void
resize_buf(struct buf *buf, size_t initial)
{
- buf->sz = buf->sz ? 2 * buf->sz : initial;
+ buf->sz = buf->sz > initial/2 ? 2 * buf->sz : initial;
buf->buf = realloc(buf->buf, buf->sz);
if (NULL == buf->buf) {
perror(NULL);
Index: roff.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/roff.c,v
retrieving revision 1.23
diff -u -p -r1.23 roff.c
--- roff.c 9 Dec 2010 20:56:30 -0000 1.23
+++ roff.c 19 Dec 2010 12:34:58 -0000
@@ -345,18 +345,11 @@ roff_res(struct roff *r, char **bufp, si
size_t nsz;
char *n;
- /* String escape sequences have at least three characters. */
+ /* Search for a leading backslash and save a pointer to it. */
- for (cp = *bufp + pos; cp[0] && cp[1] && cp[2]; cp++) {
-
- /*
- * The first character must be a backslash.
- * Save a pointer to it.
- */
-
- if ('\\' != *cp)
- continue;
- stesc = cp;
+ cp = *bufp + pos;
+ while (NULL != (cp = strchr(cp, '\\'))) {
+ stesc = cp++;
/*
* The second character must be an asterisk.
@@ -364,7 +357,9 @@ roff_res(struct roff *r, char **bufp, si
* so it can't start another escape sequence.
*/
- if ('*' != *(++cp))
+ if ('\0' == *cp)
+ return(1);
+ if ('*' != *cp++)
continue;
/*
@@ -373,7 +368,9 @@ roff_res(struct roff *r, char **bufp, si
* Save a pointer to the name.
*/
- switch (*(++cp)) {
+ switch (*cp) {
+ case ('\0'):
+ return(1);
case ('('):
cp++;
maxl = 2;
--
To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv
next prev parent reply other threads:[~2010-12-19 12:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4CF65D82.2090302@bsd.lv>
[not found] ` <20101201145258.GA18473@iris.usta.de>
[not found] ` <4CF662C5.8070806@bsd.lv>
[not found] ` <20101202200205.GA12188@iris.usta.de>
[not found] ` <4CF82337.2060203@bsd.lv>
[not found] ` <20101202232111.GE12188@iris.usta.de>
[not found] ` <4CFCE8A6.7000101@bsd.lv>
[not found] ` <4CFCE997.6000700@bsd.lv>
[not found] ` <20101206142051.GA6999@iris.usta.de>
[not found] ` <4CFD0AE3.8050502@bsd.lv>
2010-12-11 17:02 ` Ingo Schwarze
2010-12-11 17:07 ` Ingo Schwarze
2010-12-19 12:41 ` Ingo Schwarze [this message]
2010-12-20 14:50 ` Kristaps Dzonsons
2010-12-21 2:00 ` 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=20101219124116.GC4280@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).