]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Make xgettext -D and -j options work together.
authorBruno Haible <bruno@clisp.org>
Wed, 29 May 2002 12:59:09 +0000 (12:59 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:08:35 +0000 (12:08 +0200)
src/ChangeLog
src/dir-list.c
src/dir-list.h
src/xgettext.c

index fc498fd7d4df79d05a67109d73cea73237c236aa..3f9355d5eb59ef830bc8ed2b1157727fd9e2b8a8 100644 (file)
@@ -1,3 +1,11 @@
+2002-05-29  Bruno Haible  <bruno@clisp.org>
+
+       * dir-list.h (dir_list_save_reset, dir_list_restore): New declarations.
+       * dir-list.c (dir_list_save_reset, dir_list_restore): New functions.
+       * xgettext.c (main): Temporarily reset the dir_list while opening
+       reading the contents of the output file.
+       Reported by Mark Eichin <eichin@thok.org>.
+
 2002-05-22  Bruno Haible  <bruno@clisp.org>
 
        * msgl-iconv.h (iconv_message_list): Add from_filename argument.
index 851b8524b121bd58f26bd3f21e73a29cefe4c661..e802e1af9fe469ea87cfff4f9d3db5be8194523f 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2000-2002 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -56,3 +56,33 @@ dir_list_nth (n)
     return NULL;
   return directory->item[n];
 }
+
+
+/* Return the current list of directories, for later use with dir_list_restore.
+   Reset the list to empty.  */
+void *
+dir_list_save_reset ()
+{
+  void *saved_value = directory;
+
+  directory = NULL;
+  return saved_value;
+}
+
+
+/* Restore a previously saved list of directories.  */
+void
+dir_list_restore (saved_value)
+     void *saved_value;
+{
+  /* Don't free the contained strings, because they may have been returned
+     by dir_list_nth and may still be in use.  */
+  if (directory != NULL)
+    {
+      if (directory->item != NULL)
+       free (directory->item);
+      free (directory);
+    }
+
+  directory = saved_value;
+}
index ffa68f0dedd8e026fac74dd18ffc0856da9915fe..38d0e1b06d0457ea510bea4bbdda22b9d7f3e0b6 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2000-2002 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -30,4 +30,11 @@ extern void dir_list_append PARAMS ((const char *directory));
 /* Return the nth directory, or NULL of n is out of range.  */
 extern const char *dir_list_nth PARAMS ((int n));
 
+/* Return the current list of directories, for later use with dir_list_restore.
+   Reset the list to empty.  */
+extern void *dir_list_save_reset PARAMS ((void));
+
+/* Restore a previously saved list of directories.  */
+extern void dir_list_restore PARAMS ((void *saved_value));
+
 #endif /* _DIR_LIST_H */
index eed8f628fbcf16608e65419d2d65eb6627395bfd..33982848b2ff8a754860170d31a4fabd5541e4a2 100644 (file)
@@ -459,7 +459,15 @@ xgettext cannot work without keywords to look for"));
 
   /* Read in the old messages, so that we can add to them.  */
   if (join_existing)
-    extract_from_file (file_name, extract_po, mdlp);
+    {
+      /* Temporarily reset the directory list to empty, because file_name
+        is an output file and therefore should not be searched for.  */
+      void *saved_directory_list = dir_list_save_reset ();
+
+      extract_from_file (file_name, extract_po, mdlp);
+
+      dir_list_restore (saved_directory_list);
+    }
 
   /* Process all input files.  */
   for (cnt = 0; cnt < file_list->nitems; ++cnt)