texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * info/indices.c (info_indices_of_file_buffer), i


From: Patrice Dumas
Subject: branch master updated: * info/indices.c (info_indices_of_file_buffer), info/nodes.c (build_tag_table, get_nodes_of_tags_table, info_create_tag) (info_node_of_tag_ext), info/nodes.h (T_IsAnchor), info/scan.c (copy_input_to_output, scan_node_contents), info/session.c (info_last_node, info_first_node, info_search_internal): add T_IsAnchor tag flag to mark that a tag is a Ref anchor tag. Do not use TAG cache.nodelen to determine if a tag is an anchor, use the flag. Initialize TAG cache.nodelen to 0 and consider th [...]
Date: Sat, 12 Oct 2024 12:42:45 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 793024aeb9 * info/indices.c (info_indices_of_file_buffer), 
info/nodes.c (build_tag_table, get_nodes_of_tags_table, info_create_tag) 
(info_node_of_tag_ext), info/nodes.h (T_IsAnchor), info/scan.c 
(copy_input_to_output, scan_node_contents), info/session.c (info_last_node, 
info_first_node, info_search_internal): add T_IsAnchor tag flag to mark that a 
tag is a Ref anchor tag.  Do not use TAG cache.nodelen to determine if a tag is 
an anchor, use the flag.  Initialize TAG cache.nodelen [...]
793024aeb9 is described below

commit 793024aeb925a970aca50fbdf08ab16b254a2a0a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Oct 12 18:42:32 2024 +0200

    * info/indices.c (info_indices_of_file_buffer), info/nodes.c
    (build_tag_table, get_nodes_of_tags_table, info_create_tag)
    (info_node_of_tag_ext), info/nodes.h (T_IsAnchor), info/scan.c
    (copy_input_to_output, scan_node_contents), info/session.c
    (info_last_node, info_first_node, info_search_internal): add
    T_IsAnchor tag flag to mark that a tag is a Ref anchor tag.  Do not
    use TAG cache.nodelen to determine if a tag is an anchor, use the
    flag.  Initialize TAG cache.nodelen to 0 and consider that the nodelen
    has not been found for a node tag if cache.nodelen is 0.
---
 ChangeLog      | 12 ++++++++++++
 info/indices.c |  2 +-
 info/nodes.c   | 18 +++++++-----------
 info/nodes.h   |  1 +
 info/scan.c    |  6 +++---
 info/session.c |  6 +++---
 6 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d90c76829f..a903ed16a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-10-12  Patrice Dumas  <pertusus@free.fr>
+
+       * info/indices.c (info_indices_of_file_buffer), info/nodes.c
+       (build_tag_table, get_nodes_of_tags_table, info_create_tag)
+       (info_node_of_tag_ext), info/nodes.h (T_IsAnchor), info/scan.c
+       (copy_input_to_output, scan_node_contents), info/session.c
+       (info_last_node, info_first_node, info_search_internal): add
+       T_IsAnchor tag flag to mark that a tag is a Ref anchor tag.  Do not
+       use TAG cache.nodelen to determine if a tag is an anchor, use the
+       flag.  Initialize TAG cache.nodelen to 0 and consider that the nodelen
+       has not been found for a node tag if cache.nodelen is 0.
+
 2024-10-12  Patrice Dumas  <pertusus@free.fr>
 
        * info/nodes.h, info/session.c: separate flag for tags from flags for
diff --git a/info/indices.c b/info/indices.c
index 055ebaeb17..38db05ed82 100644
--- a/info/indices.c
+++ b/info/indices.c
@@ -153,7 +153,7 @@ info_indices_of_file_buffer (FILE_BUFFER *file_buffer)
       for (i = 0; (tag = file_buffer->tags[i]); i++)
         {
           if (strcasestr (tag->nodename, "Index")
-              && tag->cache.nodelen != 0) /* Not an anchor. */
+              && !(tag->flags & T_IsAnchor)) /* Not an anchor. */
             {
               NODE *node;
               REFERENCE **menu;
diff --git a/info/nodes.c b/info/nodes.c
index 5a1c0ed800..ed29251052 100644
--- a/info/nodes.c
+++ b/info/nodes.c
@@ -218,10 +218,7 @@ build_tag_table (FILE_BUFFER *file_buffer)
       init_file_buffer_tag (file_buffer, entry);
 
       if (anchor)
-        entry->cache.nodelen = 0;
-      else
-        /* Record that the length is unknown. */
-        entry->cache.nodelen = -1;
+        entry->flags |= T_IsAnchor;
 
       entry->filename = file_buffer->fullpath;
 
@@ -324,9 +321,8 @@ get_nodes_of_tags_table (FILE_BUFFER *file_buffer,
 
       entry->nodestart = nodestart;
 
-      /* If a node, we don't know the length yet, but if it's an
-         anchor, the length is 0. */
-      entry->cache.nodelen = anchor ? 0 : -1;
+      if (anchor)
+        entry->flags |= T_IsAnchor;
 
       /* The filename of this node is currently known as the same as the
          name of this file. */
@@ -889,7 +885,7 @@ info_create_tag (void)
   t->nodename = 0;
   t->nodestart = 0;
   t->nodestart_adjusted = -1;
-  t->cache.nodelen = -1;
+  t->cache.nodelen = 0;
 
   return t;
 }
@@ -1247,7 +1243,7 @@ info_node_of_tag_ext (FILE_BUFFER *fb, TAG **tag_ptr, int 
fast)
 
   node = 0;
 
-  is_anchor = tag->cache.nodelen == 0;
+  is_anchor = tag->flags & T_IsAnchor;
  
   if (is_anchor)
     {
@@ -1257,7 +1253,7 @@ info_node_of_tag_ext (FILE_BUFFER *fb, TAG **tag_ptr, int 
fast)
          the anchor (we're assuming the tags are given in order),
          skipping over any preceding anchors.  */
       for (node_pos = anchor_pos - 1;
-           node_pos >= 0 && fb->tags[node_pos]->cache.nodelen == 0;
+           node_pos >= 0 && (fb->tags[node_pos]->flags & T_IsAnchor);
            node_pos--)
         ;
 
@@ -1273,7 +1269,7 @@ info_node_of_tag_ext (FILE_BUFFER *fb, TAG **tag_ptr, int 
fast)
 
   /* We haven't checked the entry pointer yet.  Look for the node
      around about it and adjust it if necessary. */
-  if (tag->cache.nodelen == -1)
+  if (tag->cache.nodelen == 0)
     {
       if (!find_node_from_tag (parent, subfile, tag))
         return NULL; /* Node not found. */
diff --git a/info/nodes.h b/info/nodes.h
index e67a78b20e..4978403016 100644
--- a/info/nodes.h
+++ b/info/nodes.h
@@ -103,6 +103,7 @@ typedef struct {
 
 /* Values for TAG.flags. */
 #define T_SeenBySearch 0x01     /* Tag has already been seen in a search. */
+#define T_IsAnchor     0x02     /* Tag is an anchor */
 
 /* The following structure is used to remember information about the contents
    of Info files that we have loaded at least once before.  The FINFO member
diff --git a/info/scan.c b/info/scan.c
index c1b903aaa6..ac02e09ead 100644
--- a/info/scan.c
+++ b/info/scan.c
@@ -883,7 +883,7 @@ copy_input_to_output (long n)
 
                 anchor_to_adjust++;
                 if (!*anchor_to_adjust
-                    || (*anchor_to_adjust)->cache.nodelen != 0)
+                    || !((*anchor_to_adjust)->flags & T_IsAnchor))
                   {
                     anchor_to_adjust = 0;
                     break;
@@ -1511,7 +1511,7 @@ scan_node_contents (NODE *node, FILE_BUFFER *fb, TAG 
**tag_ptr)
       if (!*anchor_to_adjust)
         anchor_to_adjust = 0;
       else if (*anchor_to_adjust
-               && (*anchor_to_adjust)->cache.nodelen != 0)
+               && !((*anchor_to_adjust)->flags & T_IsAnchor))
         anchor_to_adjust = 0;
 
       if (!node->subfile)
@@ -1667,7 +1667,7 @@ scan_node_contents (NODE *node, FILE_BUFFER *fb, TAG 
**tag_ptr)
     {
       /* Set nodestart_adjusted for all of the anchors in this node. */
       tag_ptr++;
-      while (*tag_ptr && (*tag_ptr)->cache.nodelen == 0)
+      while (*tag_ptr && ((*tag_ptr)->flags & T_IsAnchor))
         {
           (*tag_ptr)->nodestart_adjusted = (*tag_ptr)->nodestart
                                              - output_bytes_difference;
diff --git a/info/session.c b/info/session.c
index 7ece1afd13..660e8e477a 100644
--- a/info/session.c
+++ b/info/session.c
@@ -3037,7 +3037,7 @@ DECLARE_INFO_COMMAND (info_last_node, _("Select the last 
node in this file"))
       if (count == 0 || (count == 1 && !info_explicit_arg))
         count = -1;
       for (i = 0; count && fb->tags[i]; i++)
-        if (fb->tags[i]->cache.nodelen != 0) /* don't count anchor tags */
+        if (!(fb->tags[i]->flags & T_IsAnchor)) /* don't count anchor tags */
           {
             count--;
             last_node_tag_idx = i;
@@ -3070,7 +3070,7 @@ DECLARE_INFO_COMMAND (info_first_node, _("Select the 
first node in this file"))
       int last_node_tag_idx = -1;
 
       for (i = 0; count && fb->tags[i]; i++)
-        if (fb->tags[i]->cache.nodelen != 0) /* don't count anchor tags */
+        if (!(fb->tags[i]->flags & T_IsAnchor)) /* don't count anchor tags */
           {
             count--;
             last_node_tag_idx = i;
@@ -4195,7 +4195,7 @@ info_search_internal (char *string, WINDOW *window,
             }
           
           tag = file_buffer->tags[i];
-          if (tag->cache.nodelen != 0)
+          if (!(tag->flags & T_IsAnchor))
             break;
         }
 



reply via email to

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