This is patch e022 from upstream:

2007-01-26  Paolo Bonzini  <[EMAIL PROTECTED]>

       * sed/compile.c (check_final_program): Don't set text if the
       pending_text is initialized but empty.
       * sed/execute.c (output_line): Don't print text if it is NULL.

diff --git a/sed/compile.c b/sed/compile.c
index 20a0523..d123f41 100644
--- a/sed/compile.c
+++ b/sed/compile.c
@@ -1621,8 +1621,9 @@ check_final_program(program)
   if (pending_text)
     {
       old_text_buf->text_length = size_buffer(pending_text);
-      old_text_buf->text = MEMDUP(get_buffer(pending_text),
-                                 old_text_buf->text_length, char);
+      if (old_text_buf->text_length)
+        old_text_buf->text = MEMDUP(get_buffer(pending_text),
+                                   old_text_buf->text_length, char);
       free_buffer(pending_text);
       pending_text = NULL;
     }
diff --git a/sed/execute.c b/sed/execute.c
index 10c78f3..a927dd4 100644
--- a/sed/execute.c
+++ b/sed/execute.c
@@ -559,11 +559,12 @@ output_line(text, length, nl, outf)
   bool nl;
   struct output *outf;
 {
-  output_missing_newline(outf);
+  if (!text)
+    return;

+  output_missing_newline(outf);
   if (length)
     ck_fwrite(text, 1, length, outf->fp);
-
   if (nl)
     ck_fwrite("\n", 1, 1, outf->fp);
   else



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to