texinfo-commits
[Top][All Lists]
Advanced

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

[5594] use struct text_buffer instead


From: Gavin D. Smith
Subject: [5594] use struct text_buffer instead
Date: Wed, 21 May 2014 22:33:51 +0000

Revision: 5594
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5594
Author:   gavin
Date:     2014-05-21 22:33:50 +0000 (Wed, 21 May 2014)
Log Message:
-----------
use struct text_buffer instead

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/echo-area.c
    trunk/info/window.c
    trunk/info/window.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-05-21 21:58:42 UTC (rev 5593)
+++ trunk/ChangeLog     2014-05-21 22:33:50 UTC (rev 5594)
@@ -1,5 +1,11 @@
 2014-05-21  Gavin Smith  <address@hidden>
 
+       * info/echo-area.c (ea_possible_completions): Use text_buffer_*
+       functions instead of *_message_buffer functions.
+       * info/window.c (text_buffer_to_node): New function.
+
+2014-05-21  Gavin Smith  <address@hidden>
+
        * info/infodoc.c (dump_map_to_message_buffer): Don't call
        character_width or message_buffer_length_this_line.
        * info/window.c (message_buffer_length_this_line, character_width)

Modified: trunk/info/echo-area.c
===================================================================
--- trunk/info/echo-area.c      2014-05-21 21:58:42 UTC (rev 5593)
+++ trunk/info/echo-area.c      2014-05-21 22:33:50 UTC (rev 5594)
@@ -957,9 +957,10 @@
     {
       size_t i, l;
       size_t limit, iterations, max_label = 0;
+      struct text_buffer message;
 
-      initialize_message_buffer ();
-      printf_to_message_buffer (ngettext ("%d completion:\n",
+      text_buffer_init (&message);
+      text_buffer_printf (&message, ngettext ("%d completion:\n",
                                          "%d completions:\n",
                                          completions_found_index),
                                completions_found_index);
@@ -1008,17 +1009,17 @@
 
                   label = completions_found[l]->label;
                   printed_length = strlen (label);
-                  printf_to_message_buffer ("%s", label);
+                  text_buffer_printf (&message, "%s", label);
 
                   if (j + 1 < limit)
                     {
                       for (k = 0; k < max_label - printed_length; k++)
-                        printf_to_message_buffer (" ");
+                        text_buffer_printf (&message, " ");
                     }
                 }
               l += iterations;
             }
-          printf_to_message_buffer ("\n");
+          text_buffer_printf (&message, "\n");
         }
 
       /* Make a new node to hold onto possible completions.  Don't destroy
@@ -1026,7 +1027,7 @@
       {
         NODE *temp;
 
-        temp = message_buffer_to_node ();
+        temp = text_buffer_to_node (&message);
         add_gcable_pointer (temp->contents);
         name_internal_node (temp, compwin_name);
         possible_completions_output_node = temp;

Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-05-21 21:58:42 UTC (rev 5593)
+++ trunk/info/window.c 2014-05-21 22:33:50 UTC (rev 5594)
@@ -1249,6 +1249,22 @@
   return node;
 }
 
+NODE *
+text_buffer_to_node (struct text_buffer *tb)
+{
+  NODE *node;
+
+  node = info_create_node ();
+
+  /* Make sure that this buffer ends with a newline. */
+  text_buffer_add_char (tb, '\n');
+  node->nodelen = text_buffer_off (tb);
+  text_buffer_add_char (tb, '\0');
+
+  node->contents = text_buffer_base (tb);
+  return node;
+}
+
 /* Useful functions can be called from outside of window.c. */
 void
 initialize_message_buffer (void)

Modified: trunk/info/window.h
===================================================================
--- trunk/info/window.h 2014-05-21 21:58:42 UTC (rev 5593)
+++ trunk/info/window.h 2014-05-21 22:33:50 UTC (rev 5594)
@@ -204,6 +204,9 @@
 /* Convert the contents of the message buffer to a node. */
 extern NODE *message_buffer_to_node (void);
 
+struct text_buffer;
+extern NODE *text_buffer_to_node (struct text_buffer *tb);
+
 /* Return the length of the most recently printed line in message buffer. */
 extern int message_buffer_length_this_line (void);
 




reply via email to

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