texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6910] new function text_destroy


From: Gavin D. Smith
Subject: [6910] new function text_destroy
Date: Fri, 01 Jan 2016 21:18:47 +0000

Revision: 6910
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6910
Author:   gavin
Date:     2016-01-01 21:18:45 +0000 (Fri, 01 Jan 2016)
Log Message:
-----------
new function text_destroy

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Convert/XSParagraph/text.c
    trunk/tp/Texinfo/Convert/XSParagraph/text.h
    trunk/tp/Texinfo/Convert/XSParagraph/xspara.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-01-01 21:13:43 UTC (rev 6909)
+++ trunk/ChangeLog     2016-01-01 21:18:45 UTC (rev 6910)
@@ -1,7 +1,15 @@
 2016-01-01  Gavin Smith  <address@hidden>
 
+       * tp/Texinfo/Convert/XSParagraph/text.c (text_destroy): New 
+       function.
+       * tp/Texinfo/Convert/XSParagraph/xspara.c (xspara_add_text): Use 
+       it instead of calling free directly, because free may have been 
+       redirected to Perl's version.
+
+2016-01-01  Gavin Smith  <address@hidden>
+
        * tp/Texinfo/Convert/XSParagraph/xspara.c (xspara_new): Don't 
-       call free on TEXT objects, but reuse the storage. Attempt at 
+       call free on TEXT objects, but reuse the storage.  Attempt at 
        fixing 'Freed to wrong pool' error reported by Eli Zaretskii.
 
 2016-01-01  Eli Zaretskii  <address@hidden>

Modified: trunk/tp/Texinfo/Convert/XSParagraph/text.c
===================================================================
--- trunk/tp/Texinfo/Convert/XSParagraph/text.c 2016-01-01 21:13:43 UTC (rev 
6909)
+++ trunk/tp/Texinfo/Convert/XSParagraph/text.c 2016-01-01 21:18:45 UTC (rev 
6910)
@@ -1,4 +1,4 @@
-/* Copyright 2014, 2015 Free Software Foundation, Inc.
+/* Copyright 2014, 2015, 2016 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -74,3 +74,10 @@
   t->end = t->space = 0;
   t->text = 0;
 }
+
+void
+text_destroy (TEXT *t)
+{
+  t->end = t->space = 0;
+  free(t->text); t->text = 0;
+}

Modified: trunk/tp/Texinfo/Convert/XSParagraph/text.h
===================================================================
--- trunk/tp/Texinfo/Convert/XSParagraph/text.h 2016-01-01 21:13:43 UTC (rev 
6909)
+++ trunk/tp/Texinfo/Convert/XSParagraph/text.h 2016-01-01 21:18:45 UTC (rev 
6910)
@@ -1,5 +1,18 @@
-/* Copyright 2014, 2015 */
+/* Copyright 2014, 2015, 2016 Free Software Foundation, Inc.
 
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License 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/>. */
+
 typedef struct TEXT {
     char *text;
     size_t space;
@@ -10,5 +23,6 @@
 void text_append (TEXT *t, char *s);
 void text_append_n (TEXT *t, char *s, size_t len);
 void text_printf (TEXT *t, char *format, ...);
+void text_destroy (TEXT *t);
 
 #define text_base(t) ((t)->space ? (t)->text : (char *) 0)

Modified: trunk/tp/Texinfo/Convert/XSParagraph/xspara.c
===================================================================
--- trunk/tp/Texinfo/Convert/XSParagraph/xspara.c       2016-01-01 21:13:43 UTC 
(rev 6909)
+++ trunk/tp/Texinfo/Convert/XSParagraph/xspara.c       2016-01-01 21:18:45 UTC 
(rev 6910)
@@ -876,7 +876,7 @@
                               state.space.end = 0;
                               text_append_n (&state.space,
                                              new_space.text, new_space.end);
-                              free (new_space.text);
+                              text_destroy (&new_space);
                             }
 
                           /* Now get characters from the input. */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]