From MAILER-DAEMON Tue Feb 02 18:47:39 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aQkfb-0002P5-SV
	for mharc-groff-commit@gnu.org; Tue, 02 Feb 2016 18:47:39 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39175)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <carsten.kunze@arcor.de>) id 1aQkfZ-0002Nx-IB
	for groff-commit@gnu.org; Tue, 02 Feb 2016 18:47:39 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <carsten.kunze@arcor.de>) id 1aQkfX-0001D5-Rw
	for groff-commit@gnu.org; Tue, 02 Feb 2016 18:47:37 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:55988)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <carsten.kunze@arcor.de>) id 1aQkfX-0001Cy-OR
	for groff-commit@gnu.org; Tue, 02 Feb 2016 18:47:35 -0500
Received: from carstenkunze by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <carsten.kunze@arcor.de>) id 1aQkfW-0000DV-Qn
	for groff-commit@gnu.org; Tue, 02 Feb 2016 23:47:35 +0000
Date: Tue, 02 Feb 2016 23:47:34 +0000
Message-Id: <E1aQkfW-0000DV-Qn@vcs.savannah.gnu.org>
To: groff-commit@gnu.org
Subject: [groff] 01/01: -ms: Add inter-paragraph space to .QS and .QE
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
In-Reply-To: groff@gnu.org
References: <20160202234734.802.80990@vcs.savannah.gnu.org>
X-Git-Repo: groff
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Rev: d2dbec050f357a945dab44da7954ebc3a27946f9
Auto-Submitted: auto-generated
From: Carsten Kunze <carsten.kunze@arcor.de>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: groff-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: groff@gnu.org
List-Id: <groff-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/groff-commit>
List-Post: <mailto:groff-commit@gnu.org>
List-Help: <mailto:groff-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 02 Feb 2016 23:47:39 -0000

carstenkunze pushed a commit to branch master
in repository groff.

commit d2dbec050f357a945dab44da7954ebc3a27946f9
Author: Carsten Kunze <carsten.kunze@arcor.de>
Date:   Tue Feb 2 22:40:22 2016 +0100

    -ms: Add inter-paragraph space to .QS and .QE
    
    In the groff implementation of -ms .QS/.QE had been derived from
    .RS/.RE.  Since the latter macros don't add vertical space this had
    been the behaviour of .QS/.QE too.  Although it is not clear and
    unambiguously documented that they insert space it is consistent if
    they behave like .QP.
    
    The documentation of -ms .QP, .QS, and .QE in the manual and info page
    had been made more detailed.
    
    The issue had been reported by Douglas McIlroy <doug@cs.dartmouth.edu>
    (See mail thread starting at
    http://lists.gnu.org/archive/html/groff/2016-01/msg00033.html)
---
 ChangeLog           |   16 ++++++++++++++++
 doc/groff.texi      |   21 ++++++++++++++++++---
 tmac/groff_ms.7.man |   38 +++++++++++++++++++++++++++++++++++++-
 tmac/s.tmac         |    6 ++++++
 4 files changed, 77 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8c1dbc4..4f4c7a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2016-02-02  Carsten Kunze  <carsten.kunze@arcor.de>
+
+	* tmac/s.tmac: Macros .QS and .QE changed to insert vertical
+	inter-paragraph space.  A paragraph bracketed with .QS/.QE
+	should appear identical to a .QP paragraph followed by .LP.
+
+	* tmac/groff_ms.7.man, doc/groff.texi: Documentation of macros
+	.QS and .QE added and .QP information improved (effect of
+	registers QI and PD).
+
+	See also discussion at groff@gnu.org, thread starting at
+
+	http://lists.gnu.org/archive/html/groff/2016-01/msg00033.html
+
+	Issue reported by Douglas McIlroy <doug@cs.dartmouth.edu>
+
 2015-12-26  Carsten Kunze  <carsten.kunze@arcor.de>
 
 	* contrib/mm/m.tmac: Disable macro misc@tag in case output
diff --git a/doc/groff.texi b/doc/groff.texi
index e781486..8db136e 100644
--- a/doc/groff.texi
+++ b/doc/groff.texi
@@ -3089,7 +3089,8 @@ Default: 0.3@dmn{v}.
 @endDefmpreg
 
 @Defmpreg {QI, ms}
-Defines the indentation on both sides of a quoted (@code{QP} macro)
+Defines the indentation on both sides of a quoted (@code{QP},
+@code{QS}, and @code{QE} macros)
 paragraph.
 
 Effective: next paragraph.
@@ -3361,9 +3362,23 @@ Sets a paragraph without an initial indentation.
 @endDefmac
 
 @Defmac {QP, , ms}
-Sets a paragraph that is indented at both left and right margins.  The
-effect is identical to the @acronym{HTML} @code{<BLOCKQUOTE>} element.
+Sets a paragraph that is indented at both left and right margins
+by the amount of the register @code{QI}.
+The effect is identical to the @acronym{HTML} @code{<BLOCKQUOTE>} element.
 The next paragraph or heading returns margins to normal.
+@code{QP} inserts vertical space of amount set by register @code{PD}
+before the paragraph.
+@endDefmac
+
+@DefmacList {QS, , ms}
+@DefmacListEndx {QE, , ms}
+These macros begin and end a quoted section.
+The @code{QI} register
+controls the amount of indentation.
+Both @code{QS} and @code{QE} insert inter-paragraph vertical space
+set by register @code{PD}.
+The text between @code{QS} and @code{QE} can be structured further
+by use of the macros @code{LP} or @code{PP}.
 @endDefmac
 
 @Defmac {XP, , ms}
diff --git a/tmac/groff_ms.7.man b/tmac/groff_ms.7.man
index 9464bab..53d868a 100644
--- a/tmac/groff_ms.7.man
+++ b/tmac/groff_ms.7.man
@@ -386,13 +386,49 @@ macro to create paragraphs with no initial indent.
 .PP
 The
 .B QP
-macro indents all text at both left and right margins.
+macro indents all text at both left and right margins
+by the amount of the register
+.BR QI .
 .
 The effect is identical to the HTML
 .B <BLOCKQUOTE>
 .
 The next paragraph or heading returns margins to normal.
 .
+.B QP
+inserts the vertical space specified in register
+.B PD
+as inter-paragraph spacing.
+.
+.
+.PP
+A paragraph bracketed between the macros
+.B QS
+and
+.B QE
+has the same appearance as a paragraph started with
+.B QP
+and a following paragraph started with
+.BR LP .
+.
+Both
+.B QS
+and
+.B QE
+insert the inter-paragraph spacing specified in
+.B PD
+and the text is indented on both sides by the amount of
+.BR QI .
+.
+The text between
+.B QS
+and
+.B QE
+can be split into further paragraphs by using
+.B \&.LP
+or
+.BR \&.PP .
+.
 .
 .PP
 The
diff --git a/tmac/s.tmac b/tmac/s.tmac
index cf0eca8..190ee11 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -1298,6 +1298,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
 .\}
 .el .@error unbalanced \\$0
 .par@reset
+.if '\\$0'QE' \{\
+.	sp \\n[\\n[.ev]:PD]u
+.	ne \\n[PORPHANS]v+\\n(.Vu
+.\}
 ..
 .de @QS
 .br
@@ -1311,6 +1315,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
 .nr \\n[.ev]:ri +\\n[QI]
 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
 .par@reset
+.sp \\n[\\n[.ev]:PD]u
+.ne \\n[PORPHANS]v+\\n(.Vu
 ..
 .als @QE @RE
 .\" start boxed text


From MAILER-DAEMON Thu Feb 04 14:59:20 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aRQ3k-0001QJ-AD
	for mharc-groff-commit@gnu.org; Thu, 04 Feb 2016 14:59:20 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39377)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <carsten.kunze@arcor.de>) id 1aRQ3h-0001Q9-Lx
	for groff-commit@gnu.org; Thu, 04 Feb 2016 14:59:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <carsten.kunze@arcor.de>) id 1aRQ3g-0001nw-FV
	for groff-commit@gnu.org; Thu, 04 Feb 2016 14:59:17 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:55006)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <carsten.kunze@arcor.de>) id 1aRQ3g-0001ns-CW
	for groff-commit@gnu.org; Thu, 04 Feb 2016 14:59:16 -0500
Received: from carstenkunze by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <carsten.kunze@arcor.de>) id 1aRQ3f-0008D5-O9
	for groff-commit@gnu.org; Thu, 04 Feb 2016 19:59:15 +0000
Date: Thu, 04 Feb 2016 19:59:15 +0000
Message-Id: <E1aRQ3f-0008D5-O9@vcs.savannah.gnu.org>
To: groff-commit@gnu.org
Subject: [groff] 01/01: -ms: .QS/.QE bugfix of previous commit simplified
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
In-Reply-To: groff@gnu.org
References: <20160204195915.31528.31840@vcs.savannah.gnu.org>
X-Git-Repo: groff
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Rev: 27ab1e3213dbfb1c4976578907a7686aa55a2c50
Auto-Submitted: auto-generated
From: Carsten Kunze <carsten.kunze@arcor.de>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: groff-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: groff@gnu.org
List-Id: <groff-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/groff-commit>
List-Post: <mailto:groff-commit@gnu.org>
List-Help: <mailto:groff-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 04 Feb 2016 19:59:18 -0000

carstenkunze pushed a commit to branch master
in repository groff.

commit 27ab1e3213dbfb1c4976578907a7686aa55a2c50
Author: Carsten Kunze <carsten.kunze@arcor.de>
Date:   Thu Feb 4 20:17:49 2016 +0100

    -ms: .QS/.QE bugfix of previous commit simplified
    
    tmac/s.tmac: Bugfix of previous commit simplified (and introduced
    redundancy removed) by use of .par*start for .QS and .QE.  This is
    consistent since any other paragraph macro is using .par*start.
---
 ChangeLog   |    7 +++++++
 tmac/s.tmac |   11 +++--------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4f4c7a8..700561a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-02-04  Carsten Kunze  <carsten.kunze@arcor.de>
+
+	* tmac/s.tmac: Bugfix of previous commit simplified (and
+	introduced redundancy removed) by use of .par*start for .QS and
+	.QE.  This is consistent since any other paragraph macro is
+	using .par*start.
+
 2016-02-02  Carsten Kunze  <carsten.kunze@arcor.de>
 
 	* tmac/s.tmac: Macros .QS and .QE changed to insert vertical
diff --git a/tmac/s.tmac b/tmac/s.tmac
index 190ee11..fe25f6b 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -1297,11 +1297,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
 .	nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
 .\}
 .el .@error unbalanced \\$0
-.par@reset
-.if '\\$0'QE' \{\
-.	sp \\n[\\n[.ev]:PD]u
-.	ne \\n[PORPHANS]v+\\n(.Vu
-.\}
+.ie '\\$0'QE' .par*start 0 0
+.el .par@reset
 ..
 .de @QS
 .br
@@ -1314,9 +1311,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
 .nr \\n[.ev]:li +\\n[QI]
 .nr \\n[.ev]:ri +\\n[QI]
 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
-.par@reset
-.sp \\n[\\n[.ev]:PD]u
-.ne \\n[PORPHANS]v+\\n(.Vu
+.par*start 0 0
 ..
 .als @QE @RE
 .\" start boxed text


From MAILER-DAEMON Mon Feb 15 18:08:56 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aVSGG-0008MR-HW
	for mharc-groff-commit@gnu.org; Mon, 15 Feb 2016 18:08:56 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57782)
	by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <wl@gnu.org>)
	id 1aVSGE-0008LD-He
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:08:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wl@gnu.org>) id 1aVSGD-0003fp-AB
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:08:54 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:44298)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <wl@gnu.org>)
	id 1aVSGD-0003fd-6O
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:08:53 -0500
Received: from wl by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <wl@gnu.org>) id 1aVSFZ-0001KW-Ng
	for groff-commit@gnu.org; Mon, 15 Feb 2016 23:08:39 +0000
Date: Mon, 15 Feb 2016 23:08:13 +0000
Message-Id: <E1aVSFZ-0001KW-Ng@vcs.savannah.gnu.org>
To: groff-commit@gnu.org
Subject: [groff] 01/01: Don't use `memcpy' with NULL input or output
	argument (#47160).
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
In-Reply-To: groff@gnu.org
References: <20160215230813.5057.64277@vcs.savannah.gnu.org>
X-Git-Repo: groff
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Rev: dd9d0787a367404fa2a69234a98e7980236b60f4
Auto-Submitted: auto-generated
From: Werner LEMBERG <wl@gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: groff-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: groff@gnu.org
List-Id: <groff-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/groff-commit>
List-Post: <mailto:groff-commit@gnu.org>
List-Help: <mailto:groff-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Feb 2016 23:08:55 -0000

wl pushed a commit to branch master
in repository groff.

commit dd9d0787a367404fa2a69234a98e7980236b60f4
Author: Bálint Réczey <balint@balintreczey.hu>
Date:   Mon Feb 15 23:55:37 2016 +0100

    Don't use `memcpy' with NULL input or output argument (#47160).
    
    * src/libs/libgroff/string.cpp (string::string, string::operator=):
    Implement it.
    
    * src/roff/troff/input.cpp (temp_iterator::temp_iterator): Implement
    it.
---
 ChangeLog                    |   10 ++++++++++
 src/libs/libgroff/string.cpp |    6 ++++--
 src/roff/troff/input.cpp     |    3 ++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 700561a..b3cdf1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-02-15  Bálint Réczey  <balint@balintreczey.hu>
+
+	Don't use `memcpy' with NULL input or output argument (#47160).
+
+	* src/libs/libgroff/string.cpp (string::string, string::operator=):
+	Implement it.
+
+	* src/roff/troff/input.cpp (temp_iterator::temp_iterator): Implement
+	it.
+
 2016-02-04  Carsten Kunze  <carsten.kunze@arcor.de>
 
 	* tmac/s.tmac: Bugfix of previous commit simplified (and
diff --git a/src/libs/libgroff/string.cpp b/src/libs/libgroff/string.cpp
index da3b2dc..5614c04 100644
--- a/src/libs/libgroff/string.cpp
+++ b/src/libs/libgroff/string.cpp
@@ -98,7 +98,8 @@ string::string(const char *p)
   else {
     len = strlen(p);
     ptr = salloc(len, &sz);
-    memcpy(ptr, p, len);
+    if (len != 0)
+      memcpy(ptr, p, len);
   }
 }
 
@@ -141,7 +142,8 @@ string &string::operator=(const char *p)
     int slen = strlen(p);
     ptr = sfree_alloc(ptr, sz, slen, &sz);
     len = slen;
-    memcpy(ptr, p, len);
+    if (len != 0)
+      memcpy(ptr, p, len);
   }
   return *this;
 }
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 9594f07..163cffa 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3596,7 +3596,8 @@ inline
 temp_iterator::temp_iterator(const char *s, int len)
 {
   base = new unsigned char[len];
-  memcpy(base, s, len);
+  if (len > 0)
+    memcpy(base, s, len);
   ptr = base;
   eptr = base + len;
 }


From MAILER-DAEMON Mon Feb 15 18:18:55 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aVSPv-0001f1-3t
	for mharc-groff-commit@gnu.org; Mon, 15 Feb 2016 18:18:55 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59917)
	by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <wl@gnu.org>)
	id 1aVSPs-0001eG-R5
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:18:53 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wl@gnu.org>) id 1aVSPs-00062k-0N
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:18:52 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:44393)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <wl@gnu.org>)
	id 1aVSPr-00062f-TA
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:18:51 -0500
Received: from wl by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <wl@gnu.org>) id 1aVSPG-0003GC-LQ
	for groff-commit@gnu.org; Mon, 15 Feb 2016 23:18:17 +0000
Date: Mon, 15 Feb 2016 23:18:14 +0000
Message-Id: <E1aVSPG-0003GC-LQ@vcs.savannah.gnu.org>
To: groff-commit@gnu.org
Subject: [groff] 01/01: [pre-grohtml] Fix out-of-bounds array access (#47161).
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
In-Reply-To: groff@gnu.org
References: <20160215231814.12491.94053@vcs.savannah.gnu.org>
X-Git-Repo: groff
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Rev: 09040dbf908c2563e0d918a1dca7bb564226a0f8
Auto-Submitted: auto-generated
From: Werner LEMBERG <wl@gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: groff-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: groff@gnu.org
List-Id: <groff-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/groff-commit>
List-Post: <mailto:groff-commit@gnu.org>
List-Help: <mailto:groff-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Feb 2016 23:18:53 -0000

wl pushed a commit to branch master
in repository groff.

commit 09040dbf908c2563e0d918a1dca7bb564226a0f8
Author: Bálint Réczey <balint@balintreczey.hu>
Date:   Tue Feb 16 00:16:28 2016 +0100

    [pre-grohtml] Fix out-of-bounds array access (#47161).
    
    * src/preproc/html/pre-html.cpp (char_buffer::write_upto_newline):
    Implement it.
---
 ChangeLog                     |    7 +++++++
 src/preproc/html/pre-html.cpp |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b3cdf1d..b264974 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2016-02-15  Bálint Réczey  <balint@balintreczey.hu>
 
+	[pre-grohtml] Fix out-of-bounds array access (#47161).
+
+	* src/preproc/html/pre-html.cpp (char_buffer::write_upto_newline):
+	Implement it.
+
+2016-02-15  Bálint Réczey  <balint@balintreczey.hu>
+
 	Don't use `memcpy' with NULL input or output argument (#47160).
 
 	* src/libs/libgroff/string.cpp (string::string, string::operator=):
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 978721a..8698149 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -661,7 +661,7 @@ void char_buffer::write_upto_newline(char_block **t, int *i, int is_html)
 	&& (*t)->buffer[j] == '\n')
       j++;
     writeNbytes((*t)->buffer + (*i), j - (*i));
-    if ((*t)->buffer[j] == INLINE_LEADER_CHAR) {
+    if (j < char_block::SIZE && (*t)->buffer[j] == INLINE_LEADER_CHAR) {
       if (can_see(t, &j, HTML_IMAGE_INLINE_BEGIN))
 	write_start_image(INLINE, is_html);
       else if (can_see(t, &j, HTML_IMAGE_INLINE_END))


From MAILER-DAEMON Mon Feb 15 18:35:38 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aVSg6-0007hH-Hp
	for mharc-groff-commit@gnu.org; Mon, 15 Feb 2016 18:35:38 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36360)
	by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <wl@gnu.org>)
	id 1aVSg3-0007gl-M3
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:35:37 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wl@gnu.org>) id 1aVSg1-0001jC-MV
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:35:35 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:44507)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <wl@gnu.org>)
	id 1aVSg1-0001j7-II
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:35:33 -0500
Received: from wl by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <wl@gnu.org>) id 1aVSfN-0005c7-Tz
	for groff-commit@gnu.org; Mon, 15 Feb 2016 23:34:59 +0000
Date: Mon, 15 Feb 2016 23:34:54 +0000
Message-Id: <E1aVSfN-0005c7-Tz@vcs.savannah.gnu.org>
To: groff-commit@gnu.org
Subject: [groff] 01/01: Simplify memory allocation (#47162).
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
In-Reply-To: groff@gnu.org
References: <20160215233453.21548.94915@vcs.savannah.gnu.org>
X-Git-Repo: groff
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Rev: b780e9e8724322831e89d49773c1735cb5f94a38
Auto-Submitted: auto-generated
From: Werner LEMBERG <wl@gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: groff-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: groff@gnu.org
List-Id: <groff-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/groff-commit>
List-Post: <mailto:groff-commit@gnu.org>
List-Help: <mailto:groff-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Feb 2016 23:35:37 -0000

wl pushed a commit to branch master
in repository groff.

commit b780e9e8724322831e89d49773c1735cb5f94a38
Author: Bálint Réczey <balint@balintreczey.hu>
Date:   Tue Feb 16 00:34:24 2016 +0100

    Simplify memory allocation (#47162).
    
    Many invalid memory accesses were caught by UBSAN (e.g., invalid
    memory access in `small_temp_iterator::operator new') while
    bootstrapping hardened1-linux-amd64 Debian port in the `free_list'
    handling because it doesn't properly handle the padding between
    array elements.
    
    Some places were already #if 0-d out anyway.
    
    * src/roff/troff/input.cpp (small_temp_iterator): Remove class.
    (make_temp_iterator): Use `temp_iterator' only.
    
    * src/devices/grotty/tty.cpp (tty_glyph): Remove `free_list', `new',
    and `delete'.
    
    * src/include/color.h, src/include/color.cpp (color): Ditto.
    
    * src/roff/troff/env.cpp (tab): Ditto.
    
    * src/roff/troff/node.cpp (glyph_node): Ditto.
---
 ChangeLog                   |   26 +++++++++++++++++-
 src/devices/grotty/tty.cpp  |   27 ------------------
 src/include/color.h         |    3 --
 src/libs/libgroff/color.cpp |   25 -----------------
 src/roff/troff/env.cpp      |   32 ----------------------
 src/roff/troff/input.cpp    |   63 +-----------------------------------------
 src/roff/troff/node.cpp     |   55 -------------------------------------
 src/roff/troff/node.h       |    9 ------
 8 files changed, 27 insertions(+), 213 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b264974..14f0388 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2016-02-16  Bálint Réczey  <balint@balintreczey.hu>
+
+	Simplify memory allocation (#47162).
+
+	Many invalid memory accesses were caught by UBSAN (e.g., invalid
+	memory access in `small_temp_iterator::operator new') while
+	bootstrapping hardened1-linux-amd64 Debian port in the `free_list'
+	handling because it doesn't properly handle the padding between
+	array elements.
+
+	Some places were already #if 0-d out anyway.
+
+	* src/roff/troff/input.cpp (small_temp_iterator): Remove class.
+	(make_temp_iterator): Use `temp_iterator' only.
+
+	* src/devices/grotty/tty.cpp (tty_glyph): Remove `free_list', `new',
+	and `delete'.
+
+	* src/include/color.h, src/include/color.cpp (color): Ditto.
+
+	* src/roff/troff/env.cpp (tab): Ditto.
+
+	* src/roff/troff/node.cpp (glyph_node): Ditto.
+
 2016-02-15  Bálint Réczey  <balint@balintreczey.hu>
 
 	[pre-grohtml] Fix out-of-bounds array access (#47161).
@@ -62,7 +86,7 @@
 	gropdf was choking on -I flag passed by groff, now uses
 	these directories to search for included pdfs.
 	
-	* src/devices/gropdf/gropdf.pl: Handle -I flag, avoid 
+	* src/devices/gropdf/gropdf.pl: Handle -I flag, avoid
 	  unitialised values.
 	
 	* src/roff/groff/groff.1.man: Include 'X pdf: pdfpic'
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index 60d46e8..d6308b6 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -153,7 +153,6 @@ void tty_font::handle_x_command(int argc, const char **argv)
 #endif
 
 class tty_glyph {
-  static tty_glyph *free_list;
 public:
   tty_glyph *next;
   int w;
@@ -162,37 +161,11 @@ public:
   unsigned char mode;
   schar back_color_idx;
   schar fore_color_idx;
-  void *operator new(size_t);
-  void operator delete(void *);
   inline int draw_mode() { return mode & (VDRAW_MODE|HDRAW_MODE); }
   inline int order() {
     return mode & (VDRAW_MODE|HDRAW_MODE|CU_MODE|COLOR_CHANGE); }
 };
 
-tty_glyph *tty_glyph::free_list = 0;
-
-void *tty_glyph::operator new(size_t)
-{
-  if (!free_list) {
-    const int BLOCK = 1024;
-    free_list = (tty_glyph *)new char[sizeof(tty_glyph) * BLOCK];
-    for (int i = 0; i < BLOCK - 1; i++)
-      free_list[i].next = free_list + i + 1;
-    free_list[BLOCK - 1].next = 0;
-  }
-  tty_glyph *p = free_list;
-  free_list = free_list->next;
-  p->next = 0;
-  return p;
-}
-
-void tty_glyph::operator delete(void *p)
-{
-  if (p) {
-    ((tty_glyph *)p)->next = free_list;
-    free_list = (tty_glyph *)p;
-  }
-}
 
 class tty_printer : public printer {
   tty_glyph **lines;
diff --git a/src/include/color.h b/src/include/color.h
index 9765686..24fb151 100644
--- a/src/include/color.h
+++ b/src/include/color.h
@@ -28,7 +28,6 @@ private:
   color_scheme scheme;
   unsigned int components[4];
   color *next;
-  static color *free_list;
 
   int read_encoding(const color_scheme, const char * const,
 		    const size_t);
@@ -39,8 +38,6 @@ public:
   color(symbol s = default_symbol) : scheme(DEFAULT), nm(s) {}
   color(const color * const);
   ~color();
-  void *operator new(size_t);
-  void operator delete(void *);
 
   int operator==(const color & c) const;
   int operator!=(const color & c) const;
diff --git a/src/libs/libgroff/color.cpp b/src/libs/libgroff/color.cpp
index 3efc097..e0ea323 100644
--- a/src/libs/libgroff/color.cpp
+++ b/src/libs/libgroff/color.cpp
@@ -43,31 +43,6 @@ min(const unsigned int a, const unsigned int b)
     return b;
 }
 
-color *color::free_list = 0;
-
-void *color::operator new(size_t n)
-{
-  assert(n == sizeof(color));
-  if (!free_list) {
-    const int BLOCK = 128;
-    free_list = (color *)new char[sizeof(color)*BLOCK];
-    for (int i = 0; i < BLOCK - 1; i++)
-      free_list[i].next = free_list + i + 1;
-    free_list[BLOCK-1].next = 0;
-  }
-  color *p = free_list;
-  free_list = (color *)(free_list->next);
-  p->next = 0;
-  return p;
-}
-
-void color::operator delete(void *p)
-{
-  if (p) {
-    ((color *)p)->next = free_list;
-    free_list = (color *)p;
-  }
-}
 
 color::color(const color * const c)
 {
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 9fbd592..1d8846f 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2543,40 +2543,8 @@ struct tab {
   tab_type type;
   tab(hunits, tab_type);
   enum { BLOCK = 1024 };
-  static tab *free_list;
-  void *operator new(size_t);
-  void operator delete(void *);
 };
 
-tab *tab::free_list = 0;
-
-void *tab::operator new(size_t n)
-{
-  assert(n == sizeof(tab));
-  if (!free_list) {
-    free_list = (tab *)new char[sizeof(tab)*BLOCK];
-    for (int i = 0; i < BLOCK - 1; i++)
-      free_list[i].next = free_list + i + 1;
-    free_list[BLOCK-1].next = 0;
-  }
-  tab *p = free_list;
-  free_list = (tab *)(free_list->next);
-  p->next = 0;
-  return p;
-}
-
-#ifdef __GNUG__
-/* cfront can't cope with this. */
-inline
-#endif
-void tab::operator delete(void *p)
-{
-  if (p) {
-    ((tab *)p)->next = free_list;
-    free_list = (tab *)p;
-  }
-}
-
 tab::tab(hunits x, tab_type t) : next(0), pos(x), type(t)
 {
 }
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 163cffa..2d346d7 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3607,73 +3607,14 @@ temp_iterator::~temp_iterator()
   a_delete base;
 }
 
-class small_temp_iterator : public input_iterator {
-private:
-  small_temp_iterator(const char *, int);
-  ~small_temp_iterator();
-  enum { BLOCK = 16 };
-  static small_temp_iterator *free_list;
-  void *operator new(size_t);
-  void operator delete(void *);
-  enum { SIZE = 12 };
-  unsigned char buf[SIZE];
-  friend input_iterator *make_temp_iterator(const char *);
-};
-
-small_temp_iterator *small_temp_iterator::free_list = 0;
-
-void *small_temp_iterator::operator new(size_t n)
-{
-  assert(n == sizeof(small_temp_iterator));
-  if (!free_list) {
-    free_list =
-      (small_temp_iterator *)new char[sizeof(small_temp_iterator)*BLOCK];
-    for (int i = 0; i < BLOCK - 1; i++)
-      free_list[i].next = free_list + i + 1;
-    free_list[BLOCK-1].next = 0;
-  }
-  small_temp_iterator *p = free_list;
-  free_list = (small_temp_iterator *)(free_list->next);
-  p->next = 0;
-  return p;
-}
-
-#ifdef __GNUG__
-inline
-#endif
-void small_temp_iterator::operator delete(void *p)
-{
-  if (p) {
-    ((small_temp_iterator *)p)->next = free_list;
-    free_list = (small_temp_iterator *)p;
-  }
-}
-
-small_temp_iterator::~small_temp_iterator()
-{
-}
-
-#ifdef __GNUG__
-inline
-#endif
-small_temp_iterator::small_temp_iterator(const char *s, int len)
-{
-  for (int i = 0; i < len; i++)
-    buf[i] = s[i];
-  ptr = buf;
-  eptr = buf + len;
-}
 
 input_iterator *make_temp_iterator(const char *s)
 {
   if (s == 0)
-    return new small_temp_iterator(s, 0);
+    return new temp_iterator(s, 0);
   else {
     int n = strlen(s);
-    if (n <= small_temp_iterator::SIZE)
-      return new small_temp_iterator(s, n);
-    else
-      return new temp_iterator(s, n);
+    return new temp_iterator(s, n);
   }
 }
 
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 3eca523..a6ab1b5 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -1847,7 +1847,6 @@ int charinfo_node::overlaps_vertically()
 }
 
 class glyph_node : public charinfo_node {
-  static glyph_node *free_list;
 protected:
   tfont *tf;
   color *gcol;
@@ -1858,8 +1857,6 @@ protected:
 	     statem *, int, node * = 0);
 #endif
 public:
-  void *operator new(size_t);
-  void operator delete(void *);
   glyph_node(charinfo *, tfont *, color *, color *,
 	     statem *, int, node * = 0);
   ~glyph_node() {}
@@ -1892,8 +1889,6 @@ public:
   void debug_node();
 };
 
-glyph_node *glyph_node::free_list = 0;
-
 class ligature_node : public glyph_node {
   node *n1;
   node *n2;
@@ -1975,35 +1970,11 @@ public:
   int is_tag();
 };
 
-void *glyph_node::operator new(size_t n)
-{
-  assert(n == sizeof(glyph_node));
-  if (!free_list) {
-    const int BLOCK = 1024;
-    free_list = (glyph_node *)new char[sizeof(glyph_node)*BLOCK];
-    for (int i = 0; i < BLOCK - 1; i++)
-      free_list[i].next = free_list + i + 1;
-    free_list[BLOCK-1].next = 0;
-  }
-  glyph_node *p = free_list;
-  free_list = (glyph_node *)(free_list->next);
-  p->next = 0;
-  return p;
-}
-
 void *ligature_node::operator new(size_t n)
 {
   return new char[n];
 }
 
-void glyph_node::operator delete(void *p)
-{
-  if (p) {
-    ((glyph_node *)p)->next = free_list;
-    free_list = (glyph_node *)p;
-  }
-}
-
 void ligature_node::operator delete(void *p)
 {
   delete[] (char *)p;
@@ -3195,32 +3166,6 @@ int node::merge_space(hunits, hunits, hunits)
   return 0;
 }
 
-#if 0
-space_node *space_node::free_list = 0;
-
-void *space_node::operator new(size_t n)
-{
-  assert(n == sizeof(space_node));
-  if (!free_list) {
-    free_list = (space_node *)new char[sizeof(space_node)*BLOCK];
-    for (int i = 0; i < BLOCK - 1; i++)
-      free_list[i].next = free_list + i + 1;
-    free_list[BLOCK-1].next = 0;
-  }
-  space_node *p = free_list;
-  free_list = (space_node *)(free_list->next);
-  p->next = 0;
-  return p;
-}
-
-inline void space_node::operator delete(void *p)
-{
-  if (p) {
-    ((space_node *)p)->next = free_list;
-    free_list = (space_node *)p;
-  }
-}
-#endif
 
 space_node::space_node(hunits nn, color *c, node *p)
 : node(p, 0, 0), n(nn), set(0), was_escape_colon(0), col(c)
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index bf3e154..46c065a 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -165,11 +165,6 @@ public:
 
 class space_node : public node {
 private:
-#if 0
-  enum { BLOCK = 1024 };
-  static space_node *free_list;
-  void operator delete(void *);
-#endif
 protected:
   hunits n;
   char set;
@@ -178,10 +173,6 @@ protected:
   space_node(hunits, int, int, color *, statem *, int, node * = 0);
 public:
   space_node(hunits, color *, node * = 0);
-#if 0
-  ~space_node();
-  void *operator new(size_t);
-#endif
   node *copy();
   int nspaces();
   hunits width();


From MAILER-DAEMON Mon Feb 15 18:42:46 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aVSn0-0008V9-FT
	for mharc-groff-commit@gnu.org; Mon, 15 Feb 2016 18:42:46 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37400)
	by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <wl@gnu.org>)
	id 1aVSmx-0008Tl-El
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:42:44 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wl@gnu.org>) id 1aVSmw-0002pQ-F0
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:42:43 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:44591)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <wl@gnu.org>)
	id 1aVSmw-0002pG-Ba
	for groff-commit@gnu.org; Mon, 15 Feb 2016 18:42:42 -0500
Received: from wl by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <wl@gnu.org>) id 1aVSmL-0006ID-7S
	for groff-commit@gnu.org; Mon, 15 Feb 2016 23:42:10 +0000
Date: Mon, 15 Feb 2016 23:42:05 +0000
Message-Id: <E1aVSmL-0006ID-7S@vcs.savannah.gnu.org>
To: groff-commit@gnu.org
Subject: [groff] 01/01: Use `malloc' in `strsave';
	use `free' for returned pointers (#47164).
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
In-Reply-To: groff@gnu.org
References: <20160215234205.24110.45535@vcs.savannah.gnu.org>
X-Git-Repo: groff
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Rev: 5ee77445e5335ac3ffc19989a3f5c7e8e1bb386e
Auto-Submitted: auto-generated
From: Werner LEMBERG <wl@gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: groff-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: groff@gnu.org
List-Id: <groff-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/groff-commit>
List-Post: <mailto:groff-commit@gnu.org>
List-Help: <mailto:groff-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Feb 2016 23:42:44 -0000

wl pushed a commit to branch master
in repository groff.

commit 5ee77445e5335ac3ffc19989a3f5c7e8e1bb386e
Author: Bálint Réczey <balint@balintreczey.hu>
Date:   Tue Feb 16 00:40:53 2016 +0100

    Use `malloc' in `strsave'; use `free' for returned pointers (#47164).
    
    * src/libs/libgroff/font.cpp (text_file::~text_file): Use `free'.
    
    * src/libs/libgroff/searchpath.cpp (search_path::open_file): Use
    `free'.
    
    * src/libs/libgroff/strsave.cpp: Include `stdlib.h'.
    (strsave): Use `malloc'.
---
 ChangeLog                        |   12 ++++++++++++
 src/libs/libgroff/font.cpp       |    2 +-
 src/libs/libgroff/searchpath.cpp |    4 ++--
 src/libs/libgroff/strsave.cpp    |    3 ++-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 14f0388..15bc013 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2016-02-16  Bálint Réczey  <balint@balintreczey.hu>
 
+	Use `malloc' in `strsave'; use `free' for returned pointers.
+
+	* src/libs/libgroff/font.cpp (text_file::~text_file): Use `free'.
+
+	* src/libs/libgroff/searchpath.cpp (search_path::open_file): Use
+	`free'.
+
+	* src/libs/libgroff/strsave.cpp: Include `stdlib.h'.
+	(strsave): Use `malloc'.
+
+2016-02-16  Bálint Réczey  <balint@balintreczey.hu>
+
 	Simplify memory allocation (#47162).
 
 	Many invalid memory accesses were caught by UBSAN (e.g., invalid
diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp
index 047a0b8..8c6ef0a 100644
--- a/src/libs/libgroff/font.cpp
+++ b/src/libs/libgroff/font.cpp
@@ -90,7 +90,7 @@ text_file::text_file(FILE *p, char *s)
 text_file::~text_file()
 {
   a_delete buf;
-  a_delete path;
+  free(path);
   if (fp)
     fclose(fp);
 }
diff --git a/src/libs/libgroff/searchpath.cpp b/src/libs/libgroff/searchpath.cpp
index f9efe11..5bd1bbc 100644
--- a/src/libs/libgroff/searchpath.cpp
+++ b/src/libs/libgroff/searchpath.cpp
@@ -130,10 +130,10 @@ FILE *search_path::open_file(const char *name, char **pathp)
       if (pathp)
 	*pathp = path;
       else
-	a_delete path;
+	free(path);
       return fp;
     }
-    a_delete path;
+    free(path);
     if (*end == '\0')
       break;
     p = end + 1;
diff --git a/src/libs/libgroff/strsave.cpp b/src/libs/libgroff/strsave.cpp
index b8b69cc..f95cfd5 100644
--- a/src/libs/libgroff/strsave.cpp
+++ b/src/libs/libgroff/strsave.cpp
@@ -18,12 +18,13 @@ You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
 #include <string.h>
+#include <stdlib.h>
 
 char *strsave(const char *s)
 {
   if (s == 0)
     return 0;
-  char *p = new char[strlen(s) + 1];
+  char *p = (char*)malloc(strlen(s) + 1);
   strcpy(p, s);
   return p;
 }


From MAILER-DAEMON Tue Feb 16 02:51:35 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aVaQ3-0008KR-MA
	for mharc-groff-commit@gnu.org; Tue, 16 Feb 2016 02:51:35 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46266)
	by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <wl@gnu.org>)
	id 1aVaPz-0008CQ-AT
	for groff-commit@gnu.org; Tue, 16 Feb 2016 02:51:34 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <wl@gnu.org>) id 1aVaPw-0000oB-IL
	for groff-commit@gnu.org; Tue, 16 Feb 2016 02:51:31 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:49178)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <wl@gnu.org>)
	id 1aVaPw-0000nw-EZ
	for groff-commit@gnu.org; Tue, 16 Feb 2016 02:51:28 -0500
Received: from wl by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <wl@gnu.org>) id 1aVaPQ-0007WI-5v
	for groff-commit@gnu.org; Tue, 16 Feb 2016 07:51:19 +0000
Date: Tue, 16 Feb 2016 07:50:56 +0000
Message-Id: <E1aVaPQ-0007WI-5v@vcs.savannah.gnu.org>
To: groff-commit@gnu.org
Subject: [groff] 01/01: Fix many malloc/new vs. free/delete/delete[]
	mismatches (#47164)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
In-Reply-To: groff@gnu.org
References: <20160216075053.28853.84015@vcs.savannah.gnu.org>
X-Git-Repo: groff
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Rev: 165ca30005f7e62d52e09cb4cff8ee227072151c
Auto-Submitted: auto-generated
From: Werner LEMBERG <wl@gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: groff-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: groff@gnu.org
List-Id: <groff-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/groff-commit>
List-Post: <mailto:groff-commit@gnu.org>
List-Help: <mailto:groff-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 16 Feb 2016 07:51:34 -0000

wl pushed a commit to branch master
in repository groff.

commit 165ca30005f7e62d52e09cb4cff8ee227072151c
Author: Bálint Réczey <balint@balintreczey.hu>
Date:   Tue Feb 16 08:49:34 2016 +0100

    Fix many malloc/new vs. free/delete/delete[] mismatches (#47164)
    
    * src/devices/grops/ps.cpp (ps_font::~ps_font,
    ps_printer::define_encoding): Use `free'.
    * src/devices/grops/psrm.cpp (resource::~resource,
    resource_manager::output_prolog, resource_manager::supply_resource,
    resource_manager::read_download_file): Ditto.
    
    * src/include/ptable.h (PTABLE::~PTABLE, PTABLE::define): Ditto.
    
    * src/libs/libgroff/searchpath.cpp
    (search_path::open_file_cautious): Ditto.
    
    * src/libs/libgroff/string.cpp: Include `stdlib.h'.
    (string::extract): Use `malloc'.
    
    * src/preproc/eqn/box.cpp (quoted_text_box::~quoted_text_box): Use
    `free'.
    
    * src/preproc/eqn/lex.cpp (definition::~definition,
    macro_input::~macro_input, top_input::~top_input, do_definition):
    Ditto.
    
    * src/preproc/eqn/main.cpp (main): Ditto.
    
    * src/preproc/eqn/other.cpp: Include `stdlib.h'.
    (size_box::~size_box, font_box::~font_box): Use `free'.
    
    * src/preproc/eqn/text.cpp: Include `stdlib.h'.
    (box::set_spacing_type, special_char_box::~special_char_box,
    split_text): Use `free'.
    
    * src/preproc/grn/main.cpp (conv): Use `free'.
    
    * src/preproc/html/pre-html.cpp (get_resolution): Ditto.
    
    * src/preproc/pic/lex.cpp (macro_input::~macro_input,
    argument_macro_input::~argument_macro_input, for_input::~for_input):
    Ditto.
    
    * src/preproc/pic/main.cpp (do_picture): Ditto.
    
    * src/preproc/pic/object.cpp: Include `stdlib.h'.
    (text_piece::~text_piece, string_list::~string_list): Use `free'.
    
    * src/preproc/pic/pic.ypp (placeless_element, element, text, label,
    expr_not_lower_than): Ditto.
    
    * src/preproc/pic/troff.cpp (troff_output::reset_color): Ditto.
    
    * src/preproc/preconv/preconv.cpp (check_coding_tag): Ditto.
    
    * src/preproc/soelim/soelim.cpp (do_file): Ditto.
    
    * src/preproc/tbl/table.cpp (text_entry::~text_entry): Ditto.
    
    * src/roff/groff/groff.cpp (possible_command::~possible_command,
    possible_command::set_name): Ditto.
    
    * src/roff/troff/env.cpp (hyphen_trie::read_patterns_file): Ditto.
    
    * src/roff/troff/node.cpp (suppress_node::tprint): Ditto.
---
 ChangeLog                        |   67 +++++++++++++++++++++++++++++++++++++-
 src/devices/grops/ps.cpp         |    4 +-
 src/devices/grops/psrm.cpp       |    8 ++--
 src/include/ptable.h             |   14 +++++---
 src/libs/libgroff/searchpath.cpp |    4 +-
 src/libs/libgroff/string.cpp     |    4 ++-
 src/preproc/eqn/box.cpp          |    2 +-
 src/preproc/eqn/lex.cpp          |    8 ++--
 src/preproc/eqn/main.cpp         |    2 +-
 src/preproc/eqn/other.cpp        |    6 ++-
 src/preproc/eqn/text.cpp         |    7 ++--
 src/preproc/grn/main.cpp         |    2 +-
 src/preproc/html/pre-html.cpp    |    2 +-
 src/preproc/pic/lex.cpp          |   10 +++---
 src/preproc/pic/main.cpp         |    3 +-
 src/preproc/pic/object.cpp       |    6 ++-
 src/preproc/pic/pic.ypp          |   20 ++++++------
 src/preproc/pic/troff.cpp        |    4 +-
 src/preproc/preconv/preconv.cpp  |    4 +-
 src/preproc/soelim/soelim.cpp    |    2 +-
 src/preproc/tbl/table.cpp        |    2 +-
 src/roff/groff/groff.cpp         |    8 ++--
 src/roff/troff/env.cpp           |    2 +-
 src/roff/troff/node.cpp          |    2 +-
 24 files changed, 135 insertions(+), 58 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 15bc013..e688ed0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,71 @@
 2016-02-16  Bálint Réczey  <balint@balintreczey.hu>
 
-	Use `malloc' in `strsave'; use `free' for returned pointers.
+	Fix many malloc/new vs. free/delete/delete[] mismatches (#47164)
+
+	* src/devices/grops/ps.cpp (ps_font::~ps_font,
+	ps_printer::define_encoding): Use `free'.
+	* src/devices/grops/psrm.cpp (resource::~resource,
+	resource_manager::output_prolog, resource_manager::supply_resource,
+	resource_manager::read_download_file): Ditto.
+
+	* src/include/ptable.h (PTABLE::~PTABLE, PTABLE::define): Ditto.
+
+	* src/libs/libgroff/searchpath.cpp
+	(search_path::open_file_cautious): Ditto.
+
+	* src/libs/libgroff/string.cpp: Include `stdlib.h'.
+	(string::extract): Use `malloc'.
+
+	* src/preproc/eqn/box.cpp (quoted_text_box::~quoted_text_box): Use
+	`free'.
+
+	* src/preproc/eqn/lex.cpp (definition::~definition,
+	macro_input::~macro_input, top_input::~top_input, do_definition):
+	Ditto.
+
+	* src/preproc/eqn/main.cpp (main): Ditto.
+
+	* src/preproc/eqn/other.cpp: Include `stdlib.h'.
+	(size_box::~size_box, font_box::~font_box): Use `free'.
+
+	* src/preproc/eqn/text.cpp: Include `stdlib.h'.
+	(box::set_spacing_type, special_char_box::~special_char_box,
+	split_text): Use `free'.
+
+	* src/preproc/grn/main.cpp (conv): Use `free'.
+
+	* src/preproc/html/pre-html.cpp (get_resolution): Ditto.
+
+	* src/preproc/pic/lex.cpp (macro_input::~macro_input,
+	argument_macro_input::~argument_macro_input, for_input::~for_input):
+	Ditto.
+
+	* src/preproc/pic/main.cpp (do_picture): Ditto.
+
+	* src/preproc/pic/object.cpp: Include `stdlib.h'.
+	(text_piece::~text_piece, string_list::~string_list): Use `free'.
+
+	* src/preproc/pic/pic.ypp (placeless_element, element, text, label,
+	expr_not_lower_than): Ditto.
+
+	* src/preproc/pic/troff.cpp (troff_output::reset_color): Ditto.
+
+	* src/preproc/preconv/preconv.cpp (check_coding_tag): Ditto.
+
+	* src/preproc/soelim/soelim.cpp (do_file): Ditto.
+
+	* src/preproc/tbl/table.cpp (text_entry::~text_entry): Ditto.
+
+	* src/roff/groff/groff.cpp (possible_command::~possible_command,
+	possible_command::set_name): Ditto.
+
+	* src/roff/troff/env.cpp (hyphen_trie::read_patterns_file): Ditto.
+
+	* src/roff/troff/node.cpp (suppress_node::tprint): Ditto.
+
+2016-02-16  Bálint Réczey  <balint@balintreczey.hu>
+
+	Use `malloc' in `strsave'; use `free' for returned pointers (#47164).
 
 	* src/libs/libgroff/font.cpp (text_file::~text_file): Use `free'.
 
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index 745a503..1215100 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.cpp
@@ -430,7 +430,7 @@ ps_font::ps_font(const char *nm)
 
 ps_font::~ps_font()
 {
-  a_delete encoding;
+  free(encoding);
   a_delete reencoded_name;
 }
 
@@ -803,7 +803,7 @@ void ps_printer::define_encoding(const char *encoding, int encoding_index)
     }
     lineno++;
   }
-  a_delete path;
+  free(path);
   out.put_literal_symbol(make_encoding_name(encoding_index))
      .put_delimiter('[');
   for (i = 0; i < 256; i++) {
diff --git a/src/devices/grops/psrm.cpp b/src/devices/grops/psrm.cpp
index 2c00b6c..4780236 100644
--- a/src/devices/grops/psrm.cpp
+++ b/src/devices/grops/psrm.cpp
@@ -150,7 +150,7 @@ resource::resource(resource_type t, string &n, string &v, unsigned r)
 
 resource::~resource()
 {
-  a_delete filename;
+  free(filename);
 }
 
 void resource::print_type_and_name(FILE *outfp)
@@ -323,7 +323,7 @@ void resource_manager::output_prolog(ps_output &out)
   putc('\n', outfp);
   process_file(-1, fp, path, outfp);
   fclose(fp);
-  a_delete path;
+  free(path);
   fputs("%%EndResource\n", outfp);
 }
 
@@ -386,7 +386,7 @@ void resource_manager::supply_resource(resource *r, int rank, FILE *outfp,
     process_file(rank, fp, path, outfp);
     fclose(fp);
     if (r->type == RESOURCE_FONT)
-      a_delete path;
+      free(path);
     if (outfp) {
       if (r->type == RESOURCE_FILE && is_document)
 	fputs("%%EndDocument\n", outfp);
@@ -1090,7 +1090,7 @@ void resource_manager::read_download_file()
       fatal_with_file_and_line(path, lineno, "missing filename");
     lookup_font(p)->filename = strsave(q);
   }
-  a_delete path;
+  free(path);
   fclose(fp);
 }
 
diff --git a/src/include/ptable.h b/src/include/ptable.h
index c43a070..410a44c 100644
--- a/src/include/ptable.h
+++ b/src/include/ptable.h
@@ -133,8 +133,10 @@ PTABLE(T)::PTABLE(T)()							      \
 PTABLE(T)::~PTABLE(T)()							      \
 {									      \
   for (unsigned i = 0; i < size; i++) {					      \
-    a_delete v[i].key;							      \
-    a_delete v[i].val;							      \
+    free(v[i].key);							      \
+    /* XXX leak, because we don't know whether */			      \
+    /* `free', `delete', or `delete[]' should be used */		      \
+    /* a_delete v[i].val; */						      \
   }									      \
   a_delete v;								      \
 }									      \
@@ -148,7 +150,9 @@ const char *PTABLE(T)::define(const char *key, T *val)			      \
        v[n].key != 0;							      \
        n = (n == 0 ? size - 1 : n - 1))					      \
     if (strcmp(v[n].key, key) == 0) {					      \
-      a_delete v[n].val;						      \
+      /* XXX leak, because we don't know whether */			      \
+      /* `free', `delete', or `delete[]' should be used */		      \
+      /* a_delete v[n].val; */						      \
       v[n].val = val;							      \
       return v[n].key;							      \
     }									      \
@@ -162,7 +166,7 @@ const char *PTABLE(T)::define(const char *key, T *val)			      \
     for (unsigned i = 0; i < old_size; i++)				      \
       if (oldv[i].key != 0) {						      \
 	if (oldv[i].val == 0)						      \
-	  a_delete oldv[i].key;						      \
+	  free(oldv[i].key);						      \
 	else {								      \
 	  unsigned j;							      \
 	  for (j = unsigned(hash_string(oldv[i].key) % size);	      	      \
@@ -179,7 +183,7 @@ const char *PTABLE(T)::define(const char *key, T *val)			      \
       ;									      \
     a_delete oldv;							      \
   }									      \
-  char *temp = new char[strlen(key)+1];					      \
+  char *temp = (char*)malloc(strlen(key)+1);				      \
   strcpy(temp, key);							      \
   v[n].key = temp;							      \
   v[n].val = val;							      \
diff --git a/src/libs/libgroff/searchpath.cpp b/src/libs/libgroff/searchpath.cpp
index 5bd1bbc..1ae0c68 100644
--- a/src/libs/libgroff/searchpath.cpp
+++ b/src/libs/libgroff/searchpath.cpp
@@ -187,11 +187,11 @@ FILE *search_path::open_file_cautious(const char *name, char **pathp,
       if (pathp)
 	*pathp = path;
       else
-	a_delete path;
+	free(path);
       return fp;
     }
     int err = errno;
-    a_delete path;
+    free(path);
     if (err != ENOENT)
     {
       errno = err;
diff --git a/src/libs/libgroff/string.cpp b/src/libs/libgroff/string.cpp
index 5614c04..e2acf02 100644
--- a/src/libs/libgroff/string.cpp
+++ b/src/libs/libgroff/string.cpp
@@ -17,6 +17,8 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include <stdlib.h>
+
 #include "lib.h"
 
 #include "stringclass.h"
@@ -286,7 +288,7 @@ char *string::extract() const
   for (i = 0; i < n; i++)
     if (p[i] == '\0')
       nnuls++;
-  char *q = new char[n + 1 - nnuls];
+  char *q =(char*)malloc(n + 1 - nnuls);
   char *r = q;
   for (i = 0; i < n; i++)
     if (p[i] != '\0')
diff --git a/src/preproc/eqn/box.cpp b/src/preproc/eqn/box.cpp
index a711ebc..0769137 100644
--- a/src/preproc/eqn/box.cpp
+++ b/src/preproc/eqn/box.cpp
@@ -551,7 +551,7 @@ quoted_text_box::quoted_text_box(char *s) : text(s)
 
 quoted_text_box::~quoted_text_box()
 {
-  a_delete text;
+  free(text);
 }
 
 void quoted_text_box::output()
diff --git a/src/preproc/eqn/lex.cpp b/src/preproc/eqn/lex.cpp
index bd5b2e0..1552326 100644
--- a/src/preproc/eqn/lex.cpp
+++ b/src/preproc/eqn/lex.cpp
@@ -47,7 +47,7 @@ definition::definition() : is_macro(1), is_simple(0)
 definition::~definition()
 {
   if (is_macro)
-    a_delete contents;
+    free(contents);
 }
 
 declare_ptable(definition)
@@ -471,7 +471,7 @@ macro_input::macro_input(const char *str, input *x) : input(x)
 
 macro_input::~macro_input()
 {
-  a_delete s;
+  free(s);
 }
 
 int macro_input::get()
@@ -498,7 +498,7 @@ top_input::top_input(const char *str, const char *fn, int ln, input *x)
 
 top_input::~top_input()
 {
-  a_delete filename;
+  free(filename);
 }
 
 int top_input::get()
@@ -963,7 +963,7 @@ void do_definition(int is_simple)
     macro_table.define(name, def);
   }
   else if (def->is_macro) {
-    a_delete def->contents;
+    free(def->contents);
   }
   get_delimited_text();
   token_buffer += '\0';
diff --git a/src/preproc/eqn/main.cpp b/src/preproc/eqn/main.cpp
index 0eb1535..44a8a9d 100644
--- a/src/preproc/eqn/main.cpp
+++ b/src/preproc/eqn/main.cpp
@@ -398,7 +398,7 @@ int main(int argc, char **argv)
     if (fp) {
       do_file(fp, path);
       fclose(fp);
-      a_delete path;
+      free(path);
     }
   }
   if (optind >= argc)
diff --git a/src/preproc/eqn/other.cpp b/src/preproc/eqn/other.cpp
index 7e00b28..227afaf 100644
--- a/src/preproc/eqn/other.cpp
+++ b/src/preproc/eqn/other.cpp
@@ -17,6 +17,8 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include <stdlib.h>
+
 #include "eqn.h"
 #include "pbox.h"
 
@@ -464,7 +466,7 @@ void size_box::output()
 
 size_box::~size_box()
 {
-  a_delete size;
+  free(size);
 }
 
 void size_box::debug_print()
@@ -481,7 +483,7 @@ font_box::font_box(char *s, box *pp) : pointer_box(pp), f(s)
 
 font_box::~font_box()
 {
-  a_delete f;
+  free(f);
 }
 
 int font_box::compute_metrics(int style)
diff --git a/src/preproc/eqn/text.cpp b/src/preproc/eqn/text.cpp
index 6607eb8..f25cc91 100644
--- a/src/preproc/eqn/text.cpp
+++ b/src/preproc/eqn/text.cpp
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
 #include <ctype.h>
+#include <stdlib.h>
 #include "eqn.h"
 #include "pbox.h"
 #include "ptable.h"
@@ -552,7 +553,7 @@ void box::set_spacing_type(char *type)
     error("unrecognised type `%1'", type);
   else
     spacing_type = t;
-  a_delete type;
+  free(type);
 }
 
 char_box::char_box(unsigned char cc)
@@ -647,7 +648,7 @@ special_char_box::special_char_box(const char *t)
 
 special_char_box::~special_char_box()
 {
-  a_delete s;
+  free(s);
 }
 
 void special_char_box::output()
@@ -941,7 +942,7 @@ box *split_text(char *text)
 	fb = b;
     }
   }
-  a_delete text;
+  free(text);
   if (lb != 0)
     return lb;
   else if (fb != 0)
diff --git a/src/preproc/grn/main.cpp b/src/preproc/grn/main.cpp
index 55fc27a..a30da33 100644
--- a/src/preproc/grn/main.cpp
+++ b/src/preproc/grn/main.cpp
@@ -552,7 +552,7 @@ conv(register FILE *fp,
 	return;
       PICTURE = DBRead(gfp);	/* read picture file */
       fclose(gfp);
-      a_delete path;
+      free(path);
       if (DBNullelt(PICTURE))
 	return;			/* If a request is made to make the  */
 				/* picture fit into a specific area, */
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 8698149..5a954bf 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -296,7 +296,7 @@ static unsigned int get_resolution(void)
   FILE *f;
   unsigned int res;
   f = font_path.open_file("devps/DESC", &pathp);
-  a_delete pathp;
+  free(pathp);
   if (f == 0)
     fatal("can't open devps/DESC");
   while (get_line(f)) {
diff --git a/src/preproc/pic/lex.cpp b/src/preproc/pic/lex.cpp
index de20276..3b96d6e 100644
--- a/src/preproc/pic/lex.cpp
+++ b/src/preproc/pic/lex.cpp
@@ -148,7 +148,7 @@ macro_input::macro_input(const char *str)
 
 macro_input::~macro_input()
 {
-  a_delete s;
+  free(s);
 }
 
 int macro_input::get()
@@ -208,8 +208,8 @@ argument_macro_input::argument_macro_input(const char *body, int ac, char **av)
 argument_macro_input::~argument_macro_input()
 {
   for (int i = 0; i < argc; i++)
-    a_delete argv[i];
-  a_delete s;
+    free(argv[i]);
+  free(s);
 }
 
 int argument_macro_input::get()
@@ -1387,8 +1387,8 @@ for_input::for_input(char *vr, double f, double t,
 
 for_input::~for_input()
 {
-  a_delete var;
-  a_delete body;
+  free(var);
+  free(body);
 }
 
 int for_input::get()
diff --git a/src/preproc/pic/main.cpp b/src/preproc/pic/main.cpp
index 1902840..0a8efa1 100644
--- a/src/preproc/pic/main.cpp
+++ b/src/preproc/pic/main.cpp
@@ -220,7 +220,8 @@ void do_picture(FILE *fp)
 {
   flyback_flag = 0;
   int c;
-  a_delete graphname;
+  if (!graphname)
+    free(graphname);
   graphname = strsave("graph");		// default picture name in TeX mode
   while ((c = getc(fp)) == ' ')
     ;
diff --git a/src/preproc/pic/object.cpp b/src/preproc/pic/object.cpp
index 282546c..bbcf946 100644
--- a/src/preproc/pic/object.cpp
+++ b/src/preproc/pic/object.cpp
@@ -17,6 +17,8 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include <stdlib.h>
+
 #include "pic.h"
 #include "ptable.h"
 #include "object.h"
@@ -540,7 +542,7 @@ text_piece::text_piece()
 
 text_piece::~text_piece()
 {
-  a_delete text;
+  free(text);
 }
 
 class graphic_object : public object {
@@ -1958,7 +1960,7 @@ string_list::string_list(char *s)
 
 string_list::~string_list()
 {
-  a_delete str;
+  free(str);
 }
   
 /* A path is used to hold the argument to the `with' attribute.  For
diff --git a/src/preproc/pic/pic.ypp b/src/preproc/pic/pic.ypp
index cf3a0d2..8decce3 100644
--- a/src/preproc/pic/pic.ypp
+++ b/src/preproc/pic/pic.ypp
@@ -315,7 +315,7 @@ placeless_element:
 	VARIABLE '=' any_expr
 		{
 		  define_variable($1, $3);
-		  a_delete $1;
+		  free($1);
 		}
 	| VARIABLE ':' '=' any_expr
 		{
@@ -327,7 +327,7 @@ placeless_element:
 		  p->obj = 0;
 		  p->x = $4;
 		  p->y = 0.0;
-		  a_delete $1;
+		  free($1);
 		}
 	| UP
 		{ current_direction = UP_DIRECTION; }
@@ -424,8 +424,8 @@ placeless_element:
 		    push_body($1.body);
 		  else
 		    push_body($4);
-		  a_delete $1.body;
-		  a_delete $4;
+		  free($1.body);
+		  free($4);
 		}
 	| reset_variables
 	| RESET
@@ -587,7 +587,7 @@ element:
 		{
 		  $$ = $4;
 		  define_label($1, & $$);
-		  a_delete $1;
+		  free($1);
 		}
 	| LABEL ':' optional_separator position_not_place
 		{
@@ -595,13 +595,13 @@ element:
 		  $$.x = $4.x;
 		  $$.y = $4.y;
 		  define_label($1, & $$);
-		  a_delete $1;
+		  free($1);
 		}
 	| LABEL ':' optional_separator place
 		{
 		  $$ = $4;
 		  define_label($1, & $$);
-		  a_delete $1;
+		  free($1);
 		}
 	| '{'
 		{
@@ -1110,7 +1110,7 @@ text:
 		  $$.lineno = $3.lineno;
 		  $$.str = do_sprintf($3.str, $4.v, $4.nv);
 		  a_delete $4.v;
-		  a_delete $3.str;
+		  free($3.str);
 		}
 	;
 
@@ -1272,7 +1272,7 @@ label:
 		    YYABORT;
 		  }
 		  $$ = *p;
-		  a_delete $1;
+		  free($1);
 		}
 	| nth_primitive
 		{ $$.obj = $1; }
@@ -1500,7 +1500,7 @@ expr_not_lower_than:
 		    lex_error("there is no variable `%1'", $1);
 		    YYABORT;
 		  }
-		  a_delete $1;
+		  free($1);
 		}
 	| NUMBER
 		{ $$ = $1; }
diff --git a/src/preproc/pic/troff.cpp b/src/preproc/pic/troff.cpp
index 112b94a..e7bf413 100644
--- a/src/preproc/pic/troff.cpp
+++ b/src/preproc/pic/troff.cpp
@@ -514,12 +514,12 @@ void troff_output::reset_color()
   if (driver_extension_flag) {
     if (last_filled) {
       printf(".fcolor\n");
-      a_delete last_filled;
+      free(last_filled);
       last_filled = 0;
     }
     if (last_outlined) {
       printf(".gcolor\n");
-      a_delete last_outlined;
+      free(last_outlined);
       last_outlined = 0;
     }
   }
diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp
index 6e65a4b..2819b5e 100644
--- a/src/preproc/preconv/preconv.cpp
+++ b/src/preproc/preconv/preconv.cpp
@@ -987,13 +987,13 @@ check_coding_tag(FILE *fp, string &data)
       d1 = get_variable_value_pair(d1, &variable, &value);
       if (!strcasecmp(variable, "coding")) {
 	*d2 = '-';		// restore '-'
-	a_delete inbuf;
+	free(inbuf);
 	return value;
       }
     }
     *d2 = '-';			// restore '-'
   }
-  a_delete inbuf;
+  free(inbuf);
   return NULL;
 }
 
diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp
index 9b315c3..3c082c9 100644
--- a/src/preproc/soelim/soelim.cpp
+++ b/src/preproc/soelim/soelim.cpp
@@ -157,7 +157,7 @@ int do_file(const char *filename)
   int err = errno;
   string whole_filename(file_name_in_path ? file_name_in_path : filename);
   whole_filename += '\0';
-  a_delete file_name_in_path;
+  free(file_name_in_path);
   if (fp == 0) {
     error("can't open `%1': %2", whole_filename.contents(), strerror(err));
     return 0;
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 436149b..10049d8 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -458,7 +458,7 @@ text_entry::text_entry(const table *p, const entry_modifier *m, char *s)
 
 text_entry::~text_entry()
 {
-  a_delete contents;
+  free(contents);
 }
 
 repeated_char_entry::repeated_char_entry(const table *p,
diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp
index b36ceae..8065598 100644
--- a/src/roff/groff/groff.cpp
+++ b/src/roff/groff/groff.cpp
@@ -581,13 +581,13 @@ possible_command::possible_command()
 
 possible_command::~possible_command()
 {
-  a_delete name;
+  free(name);
   a_delete argv;
 }
 
 void possible_command::set_name(const char *s)
 {
-  a_delete name;
+  free(name);
   name = strsave(s);
 }
 
@@ -601,8 +601,8 @@ void possible_command::clear_name()
 
 void possible_command::set_name(const char *s1, const char *s2)
 {
-  a_delete name;
-  name = new char[strlen(s1) + strlen(s2) + 1];
+  free(name);
+  name = (char*)malloc(strlen(s1) + strlen(s2) + 1);
   strcpy(name, s1);
   strcat(name, s2);
 }
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 1d8846f..40e994e 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3923,7 +3923,7 @@ void hyphen_trie::read_patterns_file(const char *name, int append,
     }
   }
   fclose(fp);
-  a_delete path;
+  free(path);
   return;
 }
 
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index a6ab1b5..e17289e 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -4080,7 +4080,7 @@ void suppress_node::tprint(troff_output_file *out)
     char *tem = (char *)last_image_filename;
     last_image_filename = strsave(filename.contents());
     if (tem)
-      a_delete tem;
+      free(tem);
     last_image_id = image_id;
     // printf("start of image and page = %d\n", current_page);
   }


From MAILER-DAEMON Mon Feb 29 00:04:58 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aaG0w-0008Fh-3b
	for mharc-groff-commit@gnu.org; Mon, 29 Feb 2016 00:04:58 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45836)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <esr@thyrsus.com>) id 1aaCIP-0006as-Cs
	for groff-commit@gnu.org; Sun, 28 Feb 2016 20:06:46 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <esr@thyrsus.com>) id 1aaCIO-0003y0-Cj
	for groff-commit@gnu.org; Sun, 28 Feb 2016 20:06:45 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:34972)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <esr@thyrsus.com>) id 1aaCIO-0003xw-9w
	for groff-commit@gnu.org; Sun, 28 Feb 2016 20:06:44 -0500
Received: from esr by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <esr@thyrsus.com>) id 1aaCHq-0004b2-RK
	for groff-commit@gnu.org; Mon, 29 Feb 2016 01:06:20 +0000
Date: Mon, 29 Feb 2016 01:06:10 +0000
Message-Id: <E1aaCHq-0004b2-RK@vcs.savannah.gnu.org>
To: groff-commit@gnu.org
Subject: [groff] 01/01: Fix erroneous quotes.  Error found by doclifter.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
In-Reply-To: groff@gnu.org
References: <20160229010610.17637.26324@vcs.savannah.gnu.org>
X-Git-Repo: groff
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Rev: ac09b133eb53c6a7df0696dae3b3e14e9930c748
Auto-Submitted: auto-generated
From: "Eric S. Raymond" <esr@thyrsus.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-Mailman-Approved-At: Mon, 29 Feb 2016 00:04:57 -0500
X-BeenThere: groff-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: groff@gnu.org
List-Id: <groff-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/groff-commit>
List-Post: <mailto:groff-commit@gnu.org>
List-Help: <mailto:groff-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Feb 2016 01:06:46 -0000

esr pushed a commit to branch master
in repository groff.

commit ac09b133eb53c6a7df0696dae3b3e14e9930c748
Author: Eric S. Raymond <esr@thyrsus.com>
Date:   Sun Feb 28 20:05:25 2016 -0500

    Fix erroneous quotes.  Error found by doclifter.
---
 contrib/pdfmark/pdfroff.1.man |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/pdfmark/pdfroff.1.man b/contrib/pdfmark/pdfroff.1.man
index 5a0fb7a..44dfee2 100644
--- a/contrib/pdfmark/pdfroff.1.man
+++ b/contrib/pdfmark/pdfroff.1.man
@@ -778,7 +778,7 @@ for inclusion in the final formatting passes.
 An intermediate
 .I PostScript
 file,
-in which \*[lq]Table of Contents\*[rq] entries are collected,
+in which \[lq]Table of Contents\[rq] entries are collected,
 to facilitate relocation before the body text,
 on ultimate output to the
 .I GhostScript


From MAILER-DAEMON Mon Feb 29 04:49:06 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aaKRu-0006gk-Hh
	for mharc-groff-commit@gnu.org; Mon, 29 Feb 2016 04:49:06 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55093)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <esr@thyrsus.com>) id 1aaKRr-0006g6-VN
	for groff-commit@gnu.org; Mon, 29 Feb 2016 04:49:04 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <esr@thyrsus.com>) id 1aaKRr-0005JR-2Q
	for groff-commit@gnu.org; Mon, 29 Feb 2016 04:49:03 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:41151)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <esr@thyrsus.com>) id 1aaKRq-0005JN-VQ
	for groff-commit@gnu.org; Mon, 29 Feb 2016 04:49:02 -0500
Received: from esr by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <esr@thyrsus.com>) id 1aaKQy-0006zJ-SW
	for groff-commit@gnu.org; Mon, 29 Feb 2016 09:48:27 +0000
Date: Mon, 29 Feb 2016 09:48:09 +0000
Message-Id: <E1aaKQy-0006zJ-SW@vcs.savannah.gnu.org>
To: groff-commit@gnu.org
Subject: [groff] 01/01: REmove unecessary instances of \"". Found by doclifter.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
In-Reply-To: groff@gnu.org
References: <20160229094808.26812.32642@vcs.savannah.gnu.org>
X-Git-Repo: groff
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Rev: b48c451fcfe9ea17f9ae51b95eada6886c1d8bde
Auto-Submitted: auto-generated
From: "Eric S. Raymond" <esr@thyrsus.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: groff-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: groff@gnu.org
List-Id: <groff-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/groff-commit>
List-Post: <mailto:groff-commit@gnu.org>
List-Help: <mailto:groff-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/groff-commit>,
	<mailto:groff-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Feb 2016 09:49:05 -0000

esr pushed a commit to branch master
in repository groff.

commit b48c451fcfe9ea17f9ae51b95eada6886c1d8bde
Author: Eric S. Raymond <esr@thyrsus.com>
Date:   Mon Feb 29 04:47:31 2016 -0500

    REmove unecessary instances of \"".  Found by doclifter.
---
 man/groff_char.7.man |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/man/groff_char.7.man b/man/groff_char.7.man
index e74906b..1869f95 100644
--- a/man/groff_char.7.man
+++ b/man/groff_char.7.man
@@ -768,10 +768,10 @@ macro:
 .nf
 .RS
 .ft C
-\&.\e" Make a pile centered vertically 0.5em\""
-\&.\e" above the baseline.\""
-\&.\e" The first argument is placed at the top.\""
-\&.\e" The pile is returned in string `pile'\""
+\&.\e" Make a pile centered vertically 0.5em
+\&.\e" above the baseline.
+\&.\e" The first argument is placed at the top.
+\&.\e" The pile is returned in string `pile'
 \&.eo
 \&.de pile-make
 \&.  nr pile-wd 0
@@ -782,16 +782,16 @@ macro:
 \&.  while \en[pile-#] \e{\e
 \&.    nr pile-wd (\en[pile-wd] >? \ew'\e$[\en[pile-#]]')
 \&.    nr pile-ht +(\en[rst] - \en[rsb])
-\&.    as pile-args \ev'\en[rsb]u'\e"\""
-\&.    as pile-args \eZ'\e$[\en[pile-#]]'\e"\""
-\&.    as pile-args \ev'-\en[rst]u'\e"\""
+\&.    as pile-args \ev'\en[rsb]u'\e"
+\&.    as pile-args \eZ'\e$[\en[pile-#]]'\e"
+\&.    as pile-args \ev'-\en[rst]u'\e"
 \&.    nr pile-# -1
 \&.  \e}
 \&.
-\&.  ds pile \ev'(-0.5m + (\en[pile-ht]u / 2u))'\e"\""
-\&.  as pile \e*[pile-args]\e"\""
-\&.  as pile \ev'((\en[pile-ht]u / 2u) + 0.5m)'\e"\""
-\&.  as pile \eh'\en[pile-wd]u'\e"\""
+\&.  ds pile \ev'(-0.5m + (\en[pile-ht]u / 2u))'\e"
+\&.  as pile \e*[pile-args]\e"
+\&.  as pile \ev'((\en[pile-ht]u / 2u) + 0.5m)'\e"
+\&.  as pile \eh'\en[pile-wd]u'\e"
 \&..
 \&.ec
 .ft


