From: Bruno Haible Date: Sat, 16 Sep 2023 15:49:23 +0000 (+0200) Subject: libgettextpo: Fix compilation error on Android. X-Git-Tag: v0.23~393 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5dc9745ce9559b2280887e9e1487a98a1a0414f;p=thirdparty%2Fgettext.git libgettextpo: Fix compilation error on Android. * 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. --- diff --git a/gettext-tools/libgettextpo/gettext-po.c b/gettext-tools/libgettextpo/gettext-po.c index 3588fdb4b..782c4a66c 100644 --- a/gettext-tools/libgettextpo/gettext-po.c +++ b/gettext-tools/libgettextpo/gettext-po.c @@ -21,6 +21,19 @@ /* 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;