texinfo-commits
[Top][All Lists]
Advanced

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

[5457] Use NODE in tag tables


From: Gavin D. Smith
Subject: [5457] Use NODE in tag tables
Date: Wed, 16 Apr 2014 18:20:06 +0000

Revision: 5457
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5457
Author:   gavin
Date:     2014-04-16 18:20:05 +0000 (Wed, 16 Apr 2014)
Log Message:
-----------
Use NODE in tag tables

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/indices.c
    trunk/info/man.c
    trunk/info/nodes.c
    trunk/info/nodes.h
    trunk/info/session.c
    trunk/info/tag.c
    trunk/info/tag.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-04-16 18:04:32 UTC (rev 5456)
+++ trunk/ChangeLog     2014-04-16 18:20:05 UTC (rev 5457)
@@ -1,5 +1,12 @@
 2014-04-16  Gavin Smith  <address@hidden>
 
+       * nodes.h (NODE): Fields nodestart and content_cache added.
+       * nodes.h (TAG): Structure type deleted.  All variables or functions
+       declared with this type changed to use NODE instead.
+       * tag.c (tags_expand): size_t -> long in arguments.
+
+2014-04-16  Gavin Smith  <address@hidden>
+
        * info/nodes.c (info_get_node_with_defaults): Free allocated
        strings on abnormal exit.
 

Modified: trunk/info/indices.c
===================================================================
--- trunk/info/indices.c        2014-04-16 18:04:32 UTC (rev 5456)
+++ trunk/info/indices.c        2014-04-16 18:20:05 UTC (rev 5457)
@@ -127,7 +127,7 @@
   /* Grovel the names of the nodes found in this file. */
   if (file_buffer->tags)
     {
-      TAG *tag;
+      NODE *tag;
 
       for (i = 0; (tag = file_buffer->tags[i]); i++)
         {
@@ -819,7 +819,7 @@
 create_virtindex_node (FILE_BUFFER *file_buffer)
 {
   NODE *node;
-  TAG *tag = file_buffer->tags[0];
+  NODE *tag = file_buffer->tags[0];
   char *text = file_buffer->contents + tag->nodestart;
 
   text += skip_node_separator (text);

Modified: trunk/info/man.c
===================================================================
--- trunk/info/man.c    2014-04-16 18:04:32 UTC (rev 5456)
+++ trunk/info/man.c    2014-04-16 18:20:05 UTC (rev 5457)
@@ -386,7 +386,7 @@
 manpage_node_of_file_buffer (FILE_BUFFER *file_buffer, char *pagename)
 {
   NODE *node = NULL;
-  TAG *tag = NULL;
+  NODE *tag = NULL;
 
   if (file_buffer->contents)
     {

Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c  2014-04-16 18:04:32 UTC (rev 5456)
+++ trunk/info/nodes.c  2014-04-16 18:20:05 UTC (rev 5457)
@@ -52,7 +52,7 @@
 static void get_tags_of_indirect_tags_table (FILE_BUFFER *file_buffer,
     SEARCH_BINDING *indirect_binding, SEARCH_BINDING *tags_binding);
 static void free_file_buffer_tags (FILE_BUFFER *file_buffer);
-static void free_info_tag (TAG *tag);
+static void free_info_tag (NODE *tag);
 
 /* Grovel FILE_BUFFER->contents finding tags and nodes, and filling in the
    various slots.  This can also be used to rebuild a tag or node table. */
@@ -175,7 +175,7 @@
   return i - binding->start;
 }
 
-/* Search through FILE_BUFFER->contents building an array of TAG *,
+/* Search through FILE_BUFFER->contents building an array of NODE *,
    one entry per each node present in the file.  Store the tags in
    FILE_BUFFER->tags, and the number of allocated slots in
    FILE_BUFFER->tags_slots. */
@@ -195,7 +195,7 @@
     {
       int start, end;
       char *nodeline;
-      TAG *entry;
+      NODE *entry;
       int anchor = 0;
 
       /* Skip past the characters just found. */
@@ -228,7 +228,7 @@
 
       /* Okay, we have isolated the node name, and we know where the
          node starts.  Remember this information. */
-      entry = xmalloc (sizeof (TAG));
+      entry = xmalloc (sizeof (NODE));
       entry->content_cache = NULL;
       entry->nodename = xmalloc (1 + (end - start));
       strncpy (entry->nodename, nodeline + start, end - start);
@@ -286,7 +286,7 @@
      Do each line until we find one that doesn't contain a node name. */
   while (search_forward ("\n", tmp_search, &position) == search_success)
     {
-      TAG *entry;
+      NODE *entry;
       char *nodedef;
       unsigned p;
       int anchor = 0;
@@ -317,7 +317,7 @@
       if (name_offset == -1)
         break;
 
-      entry = xmalloc (sizeof (TAG));
+      entry = xmalloc (sizeof (NODE));
       entry->content_cache = NULL;
 
       /* Find the beginning of the node definition. */
@@ -370,7 +370,7 @@
   int i;
   SUBFILE **subfiles = NULL;
   size_t subfiles_index = 0, subfiles_slots = 0;
-  TAG *entry;
+  NODE *entry;
 
   /* First get the list of tags from the tags table.  Then lookup the
      associated file in the indirect list for each tag, and update it. */
@@ -534,7 +534,7 @@
 
   if (file_buffer->tags)
     {
-      TAG *tag;
+      NODE *tag;
 
       for (i = 0; (tag = file_buffer->tags[i]); i++)
         free_info_tag (tag);
@@ -556,7 +556,7 @@
 
 /* Free the data associated with TAG, as well as TAG itself. */
 static void
-free_info_tag (TAG *tag)
+free_info_tag (NODE *tag)
 {
   free (tag->nodename);
   free (tag->content_cache);
@@ -874,7 +874,7 @@
                                       char *filename_in, char *nodename_in);
 static char *adjust_nodestart (NODE *node, int min, int max);
 static void node_set_body_start (NODE *node);
-static NODE *find_node_of_anchor (FILE_BUFFER *file_buffer, TAG *tag);
+static NODE *find_node_of_anchor (FILE_BUFFER *file_buffer, NODE *tag);
 static char *adjust_nodestart (NODE *node, int min, int max);
 static NODE *info_node_of_file_buffer_tags (FILE_BUFFER *file_buffer,
     char *nodename);
@@ -1068,16 +1068,16 @@
 /* Return the node that contains TAG in FILE_BUFFER, else
    (pathologically) NULL.  Called from info_node_of_file_buffer_tags.  */
 static NODE *
-find_node_of_anchor (FILE_BUFFER *file_buffer, TAG *tag)
+find_node_of_anchor (FILE_BUFFER *file_buffer, NODE *tag)
 {
   int anchor_pos, node_pos;
-  TAG *node_tag;
+  NODE *node_tag;
   NODE *node;
 
   /* Look through the tag list for the anchor.  */
   for (anchor_pos = 0; file_buffer->tags[anchor_pos]; anchor_pos++)
     {
-      TAG *t = file_buffer->tags[anchor_pos];
+      NODE *t = file_buffer->tags[anchor_pos];
       if (t->nodestart == tag->nodestart)
         break;
     }
@@ -1222,7 +1222,7 @@
 static NODE *
 info_node_of_file_buffer_tags (FILE_BUFFER *file_buffer, char *nodename)
 {
-  TAG *tag;
+  NODE *tag;
   int i;
 
   /* If no tags at all (possibly a misformatted info file), quit.  */

Modified: trunk/info/nodes.h
===================================================================
--- trunk/info/nodes.h  2014-04-16 18:04:32 UTC (rev 5456)
+++ trunk/info/nodes.h  2014-04-16 18:20:05 UTC (rev 5457)
@@ -43,6 +43,10 @@
   unsigned long display_pos;    /* Where to display at, if nonzero.  */
   long body_start;              /* Offset of the actual node body */
   int flags;                    /* See immediately below. */
+  long nodestart;               /* The offset of the start of this node. */
+  char *content_cache;          /* Cache of the node contents; used if the
+                                  node contents must be preprocessed before
+                                  displaying it. */
 } NODE;
 
 /* Defines that can appear in NODE->flags.  All informative. */
@@ -78,23 +82,6 @@
 #define INFO_FF     '\014'
 #define INFO_TAGSEP '\177'
 
-/* For each logical file that we have loaded, we keep a list of the names
-   of the nodes that are found in that file.  A pointer to a node in an
-   info file is called a "tag".  For split files, the tag pointer is
-   "indirect"; that is, the pointer also contains the name of the split
-   file where the node can be found.  For non-split files, the filename
-   member in the structure below simply contains the name of the current
-   file.  The following structure describes a single node within a file. */
-typedef struct {
-  char *filename;               /* The file where this node can be found. */
-  char *nodename;               /* The node pointed to by this tag. */
-  long nodestart;               /* The offset of the start of this node. */
-  size_t nodelen;               /* The length of this node. */
-  char *content_cache;          /* Cache of the node contents; used if the
-                                  node contents must be preprocessed before
-                                  displaying it. */
-} TAG;
-
 /* 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
    is present so that we can reload the file if it has been modified since
@@ -109,7 +96,14 @@
   char *contents;               /* The contents of this particular file. */
   size_t filesize;              /* The number of bytes this file expands to. */
   char **subfiles;              /* If non-null, the list of subfiles. */
-  TAG **tags;                   /* If non-null, the indirect tags table. */
+  NODE **tags;                  /* If non-null, the tags table. 
+           For each logical file that we have loaded, we keep a list of
+           the names of the nodes that are found in that file.  A pointer to
+           a node in an info file is called a "tag".  For split files, the
+           tag pointer is "indirect"; that is, the pointer also contains the
+           name of the split file where the node can be found.  For non-split
+           files, the filename member simply contains the name of the
+           current file. */
   size_t tags_slots;            /* Number of slots allocated for TAGS. */
   int flags;                    /* Various flags.  Mimics of N_* flags. */
 } FILE_BUFFER;

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-04-16 18:04:32 UTC (rev 5456)
+++ trunk/info/session.c        2014-04-16 18:20:05 UTC (rev 5457)
@@ -3946,7 +3946,7 @@
     {
       register int current_tag = 0, number_of_tags;
       char *last_subfile;
-      TAG *tag;
+      NODE *tag;
       char *msg = NULL;
 
       /* Find number of tags and current tag. */

Modified: trunk/info/tag.c
===================================================================
--- trunk/info/tag.c    2014-04-16 18:04:32 UTC (rev 5456)
+++ trunk/info/tag.c    2014-04-16 18:20:05 UTC (rev 5457)
@@ -206,7 +206,7 @@
    put the expanded text into PBUF, store its length in PBUFLEN, and return
    1.  Otherwise, don't touch neither of the latter and return 0. */
 int
-tags_expand (char *input, size_t inputlen, char **pbuf, size_t *pbuflen)
+tags_expand (char *input, long inputlen, char **pbuf, long *pbuflen)
 {
   char *endp = input + inputlen;
   struct text_buffer outbuf;

Modified: trunk/info/tag.h
===================================================================
--- trunk/info/tag.h    2014-04-16 18:04:32 UTC (rev 5456)
+++ trunk/info/tag.h    2014-04-16 18:20:05 UTC (rev 5457)
@@ -19,7 +19,7 @@
 #ifndef TAG_H
 #define TAG_H
 
-int tags_expand (char *input, size_t inputlen, char **pbuf, size_t *pbuflen);
+int tags_expand (char *input, long inputlen, char **pbuf, long *pbuflen);
 void handle_tag (char *tag);
 
 #endif




reply via email to

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