output: Move text_item and group_item usage closer to the SPV model.
[pspp] / src / language / lexer / lexer.c
index 2bcb18c32854748d206d1c87909bddb27b5b8a9e..11de4897724f1e4f8631e41c715e88f54c61ebd5 100644 (file)
@@ -1435,13 +1435,9 @@ lex_source_get__ (const struct lex_source *src_)
       if (copy_len > 0 && line[copy_len - 1] == '\r')
         copy_len--;
 
-      /* Make a copy of the line with \n end-of-line and null terminator. */
-      char *syntax = xmalloc (copy_len + 2);
-      memcpy (syntax, line, copy_len);
-      syntax[copy_len] = '\n';
-      syntax[copy_len + 1] = '\0';
-
-      text_item_submit (text_item_create_nocopy (TEXT_ITEM_SYNTAX, syntax));
+      /* Submit the line as syntax. */
+      text_item_submit (text_item_create_nocopy (TEXT_ITEM_SYNTAX,
+                                                 xmemdup0 (line, copy_len)));
 
       src->journal_pos += line_len;
     }