texinfo-commits
[Top][All Lists]
Advanced

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

[6483] don't save a pointer into a file buffer in a tag table


From: Gavin D. Smith
Subject: [6483] don't save a pointer into a file buffer in a tag table
Date: Wed, 29 Jul 2015 16:51:24 +0000

Revision: 6483
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6483
Author:   gavin
Date:     2015-07-29 16:51:22 +0000 (Wed, 29 Jul 2015)
Log Message:
-----------
don't save a pointer into a file buffer in a tag table

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/nodes.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-07-29 11:34:46 UTC (rev 6482)
+++ trunk/ChangeLog     2015-07-29 16:51:22 UTC (rev 6483)
@@ -1,5 +1,10 @@
 2015-07-29  Gavin Smith  <address@hidden>
 
+       * info/nodes.c (info_node_of_tag): Don't save a pointer into a 
+       file buffer, only an offset.
+
+2015-07-29  Gavin Smith  <address@hidden>
+
        * tp/Texinfo/Convert/XSParagraph/XSParagraph.pm: Heed TEXINFO_XS
        environmental variable.  Idea by Karl Berry.
 

Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c  2015-07-29 11:34:46 UTC (rev 6482)
+++ trunk/info/nodes.c  2015-07-29 16:51:22 UTC (rev 6483)
@@ -1352,8 +1352,9 @@
       set_tag_nodelen (subfile, tag);
     }
 
-  if (!tag->cache.contents)
+  if (!tag->cache.nodename)
     {
+      /* Data for node has not been generated yet. */
       NODE *cache = &tag->cache;
       cache->contents = subfile->contents + tag->nodestart_adjusted;
       cache->contents += skip_node_separator (cache->contents);
@@ -1371,11 +1372,21 @@
 
       if (!preprocess_nodes_p)
         node_set_body_start (cache);
+
+      /* Don't save a pointer into a file buffer, because it might be
+         garbage collected. */
+      if (!(cache->flags & N_WasRewritten))
+        cache->contents = 0;
     }
 
   /* Initialize the node from the tag. */
   node = xmalloc (sizeof (NODE));
   memcpy (node, &tag->cache, sizeof (NODE));
+  if (!node->contents)
+    {
+      node->contents = subfile->contents + tag->nodestart_adjusted;
+      node->contents += skip_node_separator (node->contents);
+    }
 
   /* We can't set this when tag table is built, because
      if file is split, we don't know which of the sub-files




reply via email to

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