]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Slightly better code structure.
authorBruno Haible <bruno@clisp.org>
Wed, 16 Apr 2003 10:11:03 +0000 (10:11 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:10:23 +0000 (12:10 +0200)
ChangeLog
gettext-tools/src/read-po.c
gettext-tools/src/x-po.c

index c6d952adddd99c48a62ddfcedf508abcb6eaf01d..c379b8e461a72c8fb7f02f44a204cabe34b28251 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-04-13  Bruno Haible  <bruno@clisp.org>
+
+       * read-po.c (readall_directive_message): Separate accumulation and
+       reset.
+       * x-po.c (extract_directive_message): Likewise.
+
 2003-04-12  Bruno Haible  <bruno@clisp.org>
 
        * Makefile.vms: Don't use the force target.
index 772f87629a28a23f9e70bad9d2359426aa4e7ff0..17949bc6e81f95bebd42bdc8ebbd22ea975c5839 100644 (file)
@@ -186,21 +186,16 @@ readall_directive_message (po_ty *that,
       mp->obsolete = obsolete;
     }
 
-  /* Add the accumulated comments to the message.  Clear the
-     accumulation in preparation for the next message.  */
+  /* Add the accumulated comments to the message.  */
   if (this->comment != NULL)
     {
       for (j = 0; j < this->comment->nitems; ++j)
        message_comment_append (mp, this->comment->item[j]);
-      string_list_free (this->comment);
-      this->comment = NULL;
     }
   if (this->comment_dot != NULL)
     {
       for (j = 0; j < this->comment_dot->nitems; ++j)
        message_comment_dot_append (mp, this->comment_dot->item[j]);
-      string_list_free (this->comment_dot);
-      this->comment_dot = NULL;
     }
   for (j = 0; j < this->filepos_count; ++j)
     {
@@ -208,13 +203,30 @@ readall_directive_message (po_ty *that,
 
       pp = &this->filepos[j];
       message_comment_filepos (mp, pp->file_name, pp->line_number);
-      free (pp->file_name);
     }
   mp->is_fuzzy = this->is_fuzzy;
   for (i = 0; i < NFORMATS; i++)
     mp->is_format[i] = this->is_format[i];
   mp->do_wrap = this->do_wrap;
 
+  /* Prepare for next message.  */
+  if (this->comment != NULL)
+    {
+      string_list_free (this->comment);
+      this->comment = NULL;
+    }
+  if (this->comment_dot != NULL)
+    {
+      string_list_free (this->comment_dot);
+      this->comment_dot = NULL;
+    }
+  for (j = 0; j < this->filepos_count; ++j)
+    {
+      lex_pos_ty *pp;
+
+      pp = &this->filepos[j];
+      free (pp->file_name);
+    }
   if (this->filepos != NULL)
     free (this->filepos);
   this->filepos_count = 0;
index bf7f60e2648ce08c75ce8bd191756f7bc489af9d..1c458487aa3478a3c0788764ed6b27c27765dece 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext PO backend.
-   Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -149,21 +149,16 @@ extract_directive_message (po_ty *that,
       message_list_append (this->mlp, mp);
     }
 
-  /* Add the accumulated comments to the message.  Clear the
-     accumulation in preparation for the next message. */
+  /* Add the accumulated comments to the message.  */
   if (this->comment != NULL)
     {
       for (j = 0; j < this->comment->nitems; ++j)
        message_comment_append (mp, this->comment->item[j]);
-      string_list_free (this->comment);
-      this->comment = NULL;
     }
   if (this->comment_dot != NULL)
     {
       for (j = 0; j < this->comment_dot->nitems; ++j)
        message_comment_dot_append (mp, this->comment_dot->item[j]);
-      string_list_free (this->comment_dot);
-      this->comment_dot = NULL;
     }
   mp->is_fuzzy = this->is_fuzzy;
   for (i = 0; i < NFORMATS; i++)
@@ -175,6 +170,24 @@ extract_directive_message (po_ty *that,
 
       pp = &this->filepos[j];
       message_comment_filepos (mp, pp->file_name, pp->line_number);
+    }
+
+  /* Prepare for next message.  */
+  if (this->comment != NULL)
+    {
+      string_list_free (this->comment);
+      this->comment = NULL;
+    }
+  if (this->comment_dot != NULL)
+    {
+      string_list_free (this->comment_dot);
+      this->comment_dot = NULL;
+    }
+  for (j = 0; j < this->filepos_count; ++j)
+    {
+      lex_pos_ty *pp;
+
+      pp = &this->filepos[j];
       free (pp->file_name);
     }
   if (this->filepos != NULL)