summaryrefslogtreecommitdiff
path: root/macros/texinfo/texinfo/tp/Texinfo/XS/parsetexi/errors.c
diff options
context:
space:
mode:
Diffstat (limited to 'macros/texinfo/texinfo/tp/Texinfo/XS/parsetexi/errors.c')
-rw-r--r--macros/texinfo/texinfo/tp/Texinfo/XS/parsetexi/errors.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/macros/texinfo/texinfo/tp/Texinfo/XS/parsetexi/errors.c b/macros/texinfo/texinfo/tp/Texinfo/XS/parsetexi/errors.c
index 1a57e0c8d0..522bd3434d 100644
--- a/macros/texinfo/texinfo/tp/Texinfo/XS/parsetexi/errors.c
+++ b/macros/texinfo/texinfo/tp/Texinfo/XS/parsetexi/errors.c
@@ -1,4 +1,4 @@
-/* Copyright 2010-2019 Free Software Foundation, Inc.
+/* Copyright 2010-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,17 +14,32 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
+
+
+#ifdef ENABLE_NLS
#include <libintl.h>
+#endif
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
-#include "tree_types.h"
#include "errors.h"
#include "input.h"
#include "text.h"
+void bug (char *message)
+{
+ fprintf (stderr, "texi2any (XS parser): bug: %s\n", message);
+}
+
+void fatal (char *message)
+{
+ bug (message);
+ abort ();
+}
+
+
typedef struct {
char *message;
enum error_type type;
@@ -40,8 +55,13 @@ line_error_internal (enum error_type type, LINE_NR *cmd_line_nr,
char *format, va_list v)
{
char *message;
+#ifdef ENABLE_NLS
vasprintf (&message, gettext(format), v);
- if (!message) abort ();
+#else
+ vasprintf (&message, format, v);
+#endif
+ if (!message) fatal ("vasprintf failed");
+
if (error_number == error_space)
{
error_list = realloc (error_list,