texinfo-commits
[Top][All Lists]
Advanced

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

[6835] parsetexi update


From: Gavin D. Smith
Subject: [6835] parsetexi update
Date: Sat, 05 Dec 2015 18:29:16 +0000

Revision: 6835
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6835
Author:   gavin
Date:     2015-12-05 18:29:15 +0000 (Sat, 05 Dec 2015)
Log Message:
-----------
parsetexi update

Modified Paths:
--------------
    trunk/parsetexi/handle_commands.c
    trunk/parsetexi/input.c
    trunk/parsetexi/parser.c

Modified: trunk/parsetexi/handle_commands.c
===================================================================
--- trunk/parsetexi/handle_commands.c   2015-12-05 16:51:13 UTC (rev 6834)
+++ trunk/parsetexi/handle_commands.c   2015-12-05 18:29:15 UTC (rev 6835)
@@ -124,8 +124,11 @@
          of the line if necessary. */
       if (!strchr (line, '\n'))
         {
+          char *line2;
           input_push_text (strdup (line));
-          line = new_line ();
+          line2 = new_line ();
+          if (line2)
+            line = line2;
         }
 
       misc = new_element (ET_NONE);

Modified: trunk/parsetexi/input.c
===================================================================
--- trunk/parsetexi/input.c     2015-12-05 16:51:13 UTC (rev 6834)
+++ trunk/parsetexi/input.c     2015-12-05 18:29:15 UTC (rev 6835)
@@ -125,7 +125,13 @@
             {
               char *comment;
               if (feof (input_file))
-                ; // Add a newline to the read line if one is missing.
+                {
+                  /* Add a newline at the end of the file if one is missing. */
+                  char *line2;
+                  asprintf (&line2, "%s\n", line);
+                  free (line);
+                  line = line2;
+                }
 
               /* Strip off a comment. */
               comment = strchr (line, '\x7F');

Modified: trunk/parsetexi/parser.c
===================================================================
--- trunk/parsetexi/parser.c    2015-12-05 16:51:13 UTC (rev 6834)
+++ trunk/parsetexi/parser.c    2015-12-05 18:29:15 UTC (rev 6835)
@@ -719,7 +719,7 @@
           ELEMENT *last = last_contents_child (current);
           /* Append to existing element only if the text is all
              whitespace.  */
-          if (last->type == ET_empty_line_after_command
+          if (last && last->type == ET_empty_line_after_command
               && line[strspn (line, whitespace_chars)] == '\0'
               && !strchr (last->text.text, '\n'))
             {




reply via email to

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