texinfo-commits
[Top][All Lists]
Advanced

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

[5582] fix compiler warnings


From: Gavin D. Smith
Subject: [5582] fix compiler warnings
Date: Sun, 18 May 2014 19:17:12 +0000

Revision: 5582
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5582
Author:   gavin
Date:     2014-05-18 19:17:11 +0000 (Sun, 18 May 2014)
Log Message:
-----------
fix compiler warnings

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/dir.c
    trunk/info/indices.c
    trunk/info/info-utils.c
    trunk/info/info.c
    trunk/info/man.c
    trunk/info/nodemenu.c
    trunk/info/nodes.c
    trunk/info/search.c
    trunk/info/session.c
    trunk/info/terminal.c
    trunk/info/window.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/ChangeLog     2014-05-18 19:17:11 UTC (rev 5582)
@@ -1,5 +1,40 @@
 2014-05-18  Gavin Smith  <address@hidden>
 
+       * info/dir.c (build_dir_node): Unused local variable deleted.
+       * info/indices.c (info_next_index_match): Unused local variable
+       deleted.
+       * info/info-utils.c (info_parse_node): Return 0 if nothing passed.
+       (scan_reference_label): Unused local variable deleted.
+       (scan_node_contents): Unused local variable deleted.
+       * info/info.c (get_initial_file, add_initial_nodes)
+       (allfiles_create_node, main): Unused local variables deleted.
+       (node_file_name): Deleted.
+       * info/man.c (xrefs_of_manpage): Unused variables deleted.
+       (locate_manpage_xref): Deleted.
+       * info/nodemenu.c (select_visited_node): Unused local variable
+       removed.
+       * info/nodes.c (get_nodes_of_info_file, get_file_character_encoding)
+       (set_tag_nodelen, info_node_of_tag):
+       Ununsed local variables removed.
+       (get_filename_and_nodename): Specify return type as void.
+       * info/session.c (begin_multiple_window_session)
+       (info_scroll_forward_set_window, info_scroll_backward_set_window)
+       (info_scroll_backward_page_only_set_window)
+       (info_menu_or_ref_item, info_move_to_xref, info_follow_menus): Unused
+       local variables deleted.
+       (info_display_file_info): Use "%ld" instead of "%d".
+       (dump_nodes_to_file): Use an initialized variable to print an
+       error message.  Unused variable deleted.
+       * info/search.c (regexp_search, find_node_in_binding): Unused
+       variables deleted.
+       * info/terminal.c (terminal_prep_terminal): Always return an
+       explicit value.
+       * info/window.c (window_make_modeline): Use "%ld" instead of "%d" in
+       format argument to sprintf.
+       (process_node_text): Unused variable deleted.
+
+2014-05-18  Gavin Smith  <address@hidden>
+
        * info/t (all files): Set srcdir variable before including any shell
        snippets.  Suggested by Patrice Dumas.  Other fixes for tests in
        out-of-source builds.

Modified: trunk/info/dir.c
===================================================================
--- trunk/info/dir.c    2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/dir.c    2014-05-18 19:17:11 UTC (rev 5582)
@@ -119,7 +119,7 @@
 static NODE *
 build_dir_node (void)
 {
-  int path_index, update_tags;
+  int path_index;
   char *this_dir;
   NODE *node;
 

Modified: trunk/info/indices.c
===================================================================
--- trunk/info/indices.c        2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/indices.c        2014-05-18 19:17:11 UTC (rev 5582)
@@ -369,7 +369,6 @@
 {
   register int i;
   int partial, dir;
-  NODE *node;
   size_t search_len;
   
   /* If there is no previous search string, the user hasn't built an index

Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c     2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/info-utils.c     2014-05-18 19:17:11 UTC (rev 5582)
@@ -86,7 +86,7 @@
 
   /* Special case of nothing passed.  Return nothing. */
   if (!string || !*string)
-    return;
+    return 0;
 
   if (flag != PARSE_NODE_DFLT)
     length = skip_whitespace_and_newlines (string);
@@ -1103,7 +1103,6 @@
   REFERENCE *entry;
   char *label_ptr;
   char *nl_ptr;
-  int leading_whitespace;
 
   /* We definitely have a reference by this point.  Create
      REFERENCE entity. */
@@ -1461,7 +1460,6 @@
          we position the cursor on the * when moving between references. */
       int start_of_reference; 
 
-      int colon_offset;
       REFERENCE *entry;
       char *match;
 

Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c   2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/info.c   2014-05-18 19:17:11 UTC (rev 5582)
@@ -160,17 +160,6 @@
 static void init_messages (void);
 
 
-static char *
-node_file_name (NODE *node)
-{
-  if (node->parent)
-    return node->parent;
-  else if (node->filename
-          && (!is_dir_name (filename_non_directory (node->filename))))
-    return node->filename;
-  return 0;
-}
-
 /* Get the initial Info file, either by following menus from "(dir)Top",
    or what the user specifed with values in filename. */
 static char *
@@ -180,7 +169,6 @@
 
   if (!filename)
     {
-      NODE *dir_node;
       REFERENCE *entry = 0;
 
       /* If there are any more arguments, the initial file is the
@@ -268,7 +256,6 @@
 add_initial_nodes (FILE_BUFFER *initial_file, int argc, char **argv,
                    char **error)
 {
-  NODE *initial_node;
   char *node_via_menus;
   int i;
 
@@ -430,7 +417,6 @@
 {
   int i;
   struct text_buffer text;
-  FILE_BUFFER *fb;
   
   text_buffer_init (&text);
 
@@ -796,8 +782,6 @@
          to what they want. */
       if (index_search_p && initial_file && !user_output_filename)
         {
-          NODE *initial_node;
-          
           initial_fb = info_find_file (initial_file);
           if (initial_fb && index_entry_exists (initial_fb,
                                                 index_search_string))

Modified: trunk/info/man.c
===================================================================
--- trunk/info/man.c    2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/man.c    2014-05-18 19:17:11 UTC (rev 5582)
@@ -55,7 +55,6 @@
 static char const * const exec_extensions[] = { "", NULL };
 #endif
 
-static long locate_manpage_xref (NODE *node, long int start, int dir);
 static REFERENCE **xrefs_of_manpage (NODE *node);
 static char *read_from_fd (int fd);
 static char *get_manpage_contents (char *pagename);
@@ -567,7 +566,6 @@
     {
       register int name, name_end;
       int section, section_end;
-      int name_len, section_len;
 
       for (name = position; name > 0; name--)
         if (whitespace (s.buffer[name]))
@@ -642,47 +640,3 @@
 
   return refs;
 }
-
-static long
-locate_manpage_xref (NODE *node, long int start, int dir)
-{
-  REFERENCE **refs;
-  long position = -1;
-
-  refs = xrefs_of_manpage (node);
-
-  if (refs)
-    {
-      register int i, count;
-      REFERENCE *entry;
-
-      for (i = 0; refs[i]; i++);
-      count = i;
-
-      if (dir > 0)
-        {
-          for (i = 0; (entry = refs[i]); i++)
-            if (entry->start > start)
-              {
-                position = entry->start;
-                break;
-              }
-        }
-      else
-        {
-          for (i = count - 1; i > -1; i--)
-            {
-              entry = refs[i];
-
-              if (entry->start < start)
-                {
-                  position = entry->start;
-                  break;
-                }
-            }
-        }
-
-      info_free_references (refs);
-    }
-  return position;
-}

Modified: trunk/info/nodemenu.c
===================================================================
--- trunk/info/nodemenu.c       2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/nodemenu.c       2014-05-18 19:17:11 UTC (rev 5582)
@@ -310,7 +310,6 @@
 {
   char *line;
   NODE *node;
-  REFERENCE **menu;
 
   node = get_visited_nodes (NULL);
   free (node);

Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c  2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/nodes.c  2014-05-18 19:17:11 UTC (rev 5582)
@@ -189,7 +189,7 @@
 
   while ((nodestart = find_node_separator (&binding)) != -1)
     {
-      int start, end;
+      int start;
       char *nodeline;
       NODE *entry;
       int anchor = 0;
@@ -770,8 +770,6 @@
   long int enc_start, enc_end;
   char *enc_string;
 
-  char **encoding_name;
-
   /* See if there is a local variables section in this info file. */
   binding.buffer = fb->contents;
   binding.start = fb->filesize;
@@ -896,7 +894,7 @@
 /* Functions for node creation and retrieval. */
 
 static long get_node_length (SEARCH_BINDING *binding);
-static int get_filename_and_nodename (int flag, WINDOW *window,
+static void get_filename_and_nodename (int flag, WINDOW *window,
                                       char **filename, char **nodename,
                                       char *filename_in, char *nodename_in);
 static void node_set_body_start (NODE *node);
@@ -1019,7 +1017,7 @@
 }
 
 /* Set default values.  Output values should be freed by caller. */
-static int
+static void
 get_filename_and_nodename (int flag, WINDOW *window,
                            char **filename, char **nodename,
                            char *filename_in, char *nodename_in)
@@ -1188,15 +1186,11 @@
 static void
 set_tag_nodelen (FILE_BUFFER *subfile, NODE *tag)
 {
-  int min, max;
   SEARCH_BINDING node_body;
-  char *buff_end;
 
-  buff_end = subfile->contents + subfile->filesize;
-
   node_body.buffer = tag->contents;
   node_body.start = 0;
-  node_body.end = buff_end - node_body.buffer;
+  node_body.end = subfile->contents + subfile->filesize - node_body.buffer;
   node_body.flags = 0;
   tag->nodelen = get_node_length (&node_body);
 }
@@ -1235,22 +1229,15 @@
   /* If not an anchor and contents of node are not available: */
   if (tag->nodelen != 0 && !tag->contents)
     {
-      char *new_contents;
-      long new_nodelen;
-
       /* If TAG->nodelen hasn't been calculated yet, then we aren't
          in a position to trust the entry pointer.  Adjust things so
          that ENTRY->nodestart gets the exact address of the start of
          the node separator which starts this node.  If we cannot
          do that, the node isn't really here. */
       if (tag->nodelen == -1)
-        {
-          char *node_sep;
+        if (!adjust_nodestart (subfile, tag))
+          return NULL; /* Node not found. */
 
-          if (!adjust_nodestart (subfile, tag))
-            return NULL; /* Node not found. */
-        }
-
       /* Right after the separator. */
       tag->contents = subfile->contents + tag->nodestart;
       tag->contents += skip_node_separator (tag->contents);

Modified: trunk/info/search.c
===================================================================
--- trunk/info/search.c 2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/search.c 2014-05-18 19:17:11 UTC (rev 5582)
@@ -98,7 +98,6 @@
 {
   static char *previous_regexp = NULL;
   static char *previous_content = NULL;
-  static long previous_start, previous_end;
   static int was_insensitive = 0;
   static regex_t preg;
   static regmatch_t *matches;
@@ -189,8 +188,6 @@
       char saved_char;
 
       previous_content = binding->buffer;
-      previous_start = start;
-      previous_end = end;
       saved_char = previous_content[end];
       previous_content[end] = '\0';
 
@@ -598,38 +595,31 @@
 find_node_in_binding (char *nodename, SEARCH_BINDING *binding)
 {
   long position;
-  int offset, namelen;
-  SEARCH_BINDING tmp_search;
+  int offset;
+  SEARCH_BINDING s;
 
-  namelen = strlen (nodename);
+  s.buffer = binding->buffer;
+  s.start = binding->start;
+  s.end = binding->end;
+  s.flags = 0;
 
-  tmp_search.buffer = binding->buffer;
-  tmp_search.start = binding->start;
-  tmp_search.end = binding->end;
-  tmp_search.flags = 0;
-
-  while ((position = find_node_separator (&tmp_search)) != -1)
+  while ((position = find_node_separator (&s)) != -1)
     {
       char *nodename_start;
       char *read_nodename;
-      long nodename_len;
 
-      tmp_search.start = position;
-      tmp_search.start += skip_node_separator
-        (tmp_search.buffer + tmp_search.start);
+      s.start = position;
+      s.start += skip_node_separator (s.buffer + s.start);
 
-      offset = string_in_line
-        (INFO_NODE_LABEL, tmp_search.buffer + tmp_search.start);
+      offset = string_in_line (INFO_NODE_LABEL, s.buffer + s.start);
 
       if (offset == -1)
         continue;
 
-      tmp_search.start += offset;
-      tmp_search.start += skip_whitespace (tmp_search.buffer + 
tmp_search.start);
-
-      nodename_start = tmp_search.buffer + tmp_search.start;
-      nodename_len = read_quoted_string (nodename_start, "\n\t,",
-                                         &read_nodename);
+      s.start += offset;
+      s.start += skip_whitespace (s.buffer + s.start); 
+      nodename_start = s.buffer + s.start;
+      read_quoted_string (nodename_start, "\n\t,", &read_nodename);
       if (!read_nodename)
         return -1;
 

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/session.c        2014-05-18 19:17:11 UTC (rev 5582)
@@ -94,7 +94,6 @@
 {
   register int i;
   WINDOW *window = 0;
-  FILE_BUFFER *fb;
 
   for (i = 0; references && references[i]; i++)
     {
@@ -1234,8 +1233,6 @@
 DECLARE_INFO_COMMAND (info_scroll_forward_set_window,
                       _("Scroll forward in this window and set default window 
size"))
 {
-  int lines;
-
   if (info_explicit_arg)
     default_window_size = count;
 
@@ -1247,8 +1244,6 @@
 DECLARE_INFO_COMMAND (info_scroll_backward_set_window,
                       _("Scroll backward in this window and set default window 
size"))
 {
-  int lines;
-
   if (info_explicit_arg)
     default_window_size = count;
 
@@ -1289,8 +1284,6 @@
 DECLARE_INFO_COMMAND (info_scroll_forward_page_only_set_window,
                       _("Scroll forward in this window staying within node and 
set default window size"))
 {
-  int lines;
-
   if (info_explicit_arg)
     default_window_size = count;
 
@@ -1302,8 +1295,6 @@
 DECLARE_INFO_COMMAND (info_scroll_backward_page_only_set_window,
                       _("Scroll backward in this window staying within node 
and set default window size"))
 {
-  int lines;
-
   if (info_explicit_arg)
     default_window_size = count;
 
@@ -2535,7 +2526,6 @@
         info_error (_("The reference disappeared! (%s)."), line);
       else
         {
-          NODE *orig = window->node;
           info_select_reference (window, entry);
         }
 
@@ -2623,13 +2613,9 @@
 static int
 info_move_to_xref (WINDOW *window, int count, unsigned char key, int dir)
 {
-  long firstmenu, firstxref;
-  long nextmenu, nextxref;
   long placement = -1;
-  long start = 0;
   NODE *node = window->node;
   REFERENCE **ref;
-  int nextref;
 
   /* Fail if there are no references in node */
   if (!node->references)
@@ -2818,7 +2804,6 @@
 
   for (; *menus; menus++)
     {
-      static char *first_arg = NULL;
       REFERENCE *entry;
       char *arg = *menus; /* Remember the name of the menu entry we want. */
 
@@ -3448,7 +3433,6 @@
 {
   int i;
   FILE *output_stream;
-  char *filename;
   
   if (!references)
     return;
@@ -3478,7 +3462,8 @@
                                output_stream,
                               flags & DUMP_SUBNODES) == DUMP_SYS_ERROR)
        {
-         info_error (_("error writing to %s: %s"), filename, strerror (errno));
+         info_error (_("error writing to %s: %s"), output_filename,
+                      strerror (errno));
          exit (EXIT_FAILURE);
        }
     }
@@ -3486,7 +3471,7 @@
   if (output_stream != stdout)
     fclose (output_stream);
 
-  debug (1, (_("closing %s"), filename));
+  debug (1, (_("closing %s"), output_filename));
 }
 
 /* A place to remember already dumped nodes. */
@@ -5186,9 +5171,9 @@
   if (fname)
     {
       int line = window_line_of_point (window);
-      window_message_in_echo_area ("File name: %s, line %d of %lu (%d%%)",
+      window_message_in_echo_area ("File name: %s, line %d of %ld (%ld%%)",
                                   fname, line,
-                                  (unsigned long) window->line_count,
+                                  window->line_count,
                                   line * 100 / window->line_count);
       free (fname);
     }

Modified: trunk/info/terminal.c
===================================================================
--- trunk/info/terminal.c       2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/terminal.c       2014-05-18 19:17:11 UTC (rev 5582)
@@ -700,7 +700,7 @@
   if (terminal_prep_terminal_hook)
     {
       (*terminal_prep_terminal_hook) ();
-      return;
+      return 1;
     }
 
   terminal_begin_using_terminal ();

Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-05-18 17:41:41 UTC (rev 5581)
+++ trunk/info/window.c 2014-05-18 19:17:11 UTC (rev 5582)
@@ -1108,11 +1108,11 @@
 
         /* Special internal windows have no filename. */
         if (!parent && !*filename)
-          sprintf (modeline, _("-%s---Info: %s, %d lines --%s--"),
+          sprintf (modeline, _("-%s---Info: %s, %ld lines --%s--"),
                    (window->flags & W_NoWrap) ? "$" : "-",
                    nodename, window->line_count, location_indicator);
         else
-          sprintf (modeline, _("-%s%s-Info: (%s)%s, %d lines --%s--"),
+          sprintf (modeline, _("-%s%s-Info: (%s)%s, %ld lines --%s--"),
                    (window->flags & W_NoWrap) ? "$" : "-",
                    (node && (node->flags & N_IsCompressed)) ? "zz" : "--",
                    parent ? parent : filename,
@@ -1501,9 +1501,7 @@
         {
           /* The printed representation of this character extends into
              the next line. */
-          int i;
-
-          for (i = 0; pl_chars < (win->width - 1); pl_chars++)
+          for (; pl_chars < (win->width - 1); pl_chars++)
             printed_line[pl_bytes++] = ' ';
 
           carried_over_chars = pchars;




reply via email to

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