]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
libgettextpo: Fix compilation error on Android.
authorBruno Haible <bruno@clisp.org>
Sat, 16 Sep 2023 15:49:23 +0000 (17:49 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 16 Sep 2023 15:49:23 +0000 (17:49 +0200)
* gettext-tools/libgettextpo/gettext-po.c: Include error.h second.
(orig_error, orig_error_at_line): New variables.
(error, error_at_line): Undefine afterwards.
(po_file_read_v2): Use these variables instead of the error, error_at_line
symbols.

gettext-tools/libgettextpo/gettext-po.c

index 3588fdb4b2c14a4b5f5cfb34324598aaa3315705..782c4a66ca7502f43d89ce307878ac72abb61372 100644 (file)
 /* Avoid side effect of gnulib's error.h on 'struct po_error_handler'.  */
 #define _GL_NO_INLINE_ERROR
 
+/* Avoid side effect of config.h on 'struct po_error_handler'.  */
+#include "error.h"
+static void (*orig_error) (int status, int errnum,
+                           const char *format, ...)
+  = error;
+
+static void (*orig_error_at_line) (int status, int errnum,
+                                   const char *filename, unsigned int lineno,
+                                   const char *format, ...)
+  = error_at_line;
+#undef error
+#undef error_at_line
+
 /* Specification.  */
 #include "gettext-po.h"
 
@@ -37,7 +50,6 @@
 #include "read-po.h"
 #include "write-catalog.h"
 #include "write-po.h"
-#include "error.h"
 #include "xerror.h"
 #include "po-error.h"
 #include "po-xerror.h"
@@ -174,8 +186,8 @@ po_file_read_v2 (const char *filename, po_error_handler_t handler)
   file->domains = NULL;
 
   /* Restore error handler.  */
-  po_error             = error;
-  po_error_at_line     = error_at_line;
+  po_error             = orig_error;
+  po_error_at_line     = orig_error_at_line;
   po_multiline_warning = multiline_warning;
   po_multiline_error   = multiline_error;
   gram_max_allowed_errors = 20;