[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sat, 11 May 2024 07:49:24 -0400 (EDT) |
branch: master
commit 4e25b6d12854672a4a4e83b38d5ebe5e6ad73972
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat May 11 13:49:11 2024 +0200
* tp/Texinfo/XS/Makefile.am (XSParagraph_la_SOURCES),
tp/Texinfo/XS/xspara.c, tp/Texinfo/XS/xspara.h: use main/text.c.
Remove Texinfo/XS/xspara_text.c and Texinfo/XS/xspara_text.h.
---
ChangeLog | 6 +++
tp/Texinfo/XS/Makefile.am | 3 +-
tp/Texinfo/XS/xspara.c | 3 +-
tp/Texinfo/XS/xspara.h | 2 +-
tp/Texinfo/XS/xspara_text.c | 89 ---------------------------------------------
tp/Texinfo/XS/xspara_text.h | 33 -----------------
6 files changed, 9 insertions(+), 127 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b6834cc009..5ca82d16ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-05-11 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/Makefile.am (XSParagraph_la_SOURCES),
+ tp/Texinfo/XS/xspara.c, tp/Texinfo/XS/xspara.h: use main/text.c.
+ Remove Texinfo/XS/xspara_text.c and Texinfo/XS/xspara_text.h.
+
2024-05-11 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/text.c (text_alloc): inline fatal() call
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index c4fec049fd..e054b399a3 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -86,9 +86,8 @@ MiscXS_la_LDFLAGS = $(XSLIBS_LDFLAGS)
xs_LTLIBRARIES += XSParagraph.la
nodist_XSParagraph_la_SOURCES = XSParagraph.c
CLEANFILES += XSParagraph.c
-# FIXME use main/text.*?
XSParagraph_la_SOURCES = xspara.c xspara.h \
- xspara_text.c xspara_text.h ppport.h
+ main/text.c main/text.h ppport.h
XSParagraph_la_CFLAGS = $(XSLIBS_CFLAGS)
XSParagraph_la_CPPFLAGS = $(AM_CPPFLAGS) $(GNULIB_CPPFLAGS) $(XSLIBS_CPPFLAGS)
XSParagraph_la_LIBADD = $(builddir)/gnulib/lib/libgnu.la
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index 8f486e71b3..36c0760363 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -37,10 +37,9 @@
#endif
#include "XSUB.h"
+#include "main/text.h"
#include "xspara.h"
-#include "xspara_text.h"
-
static int debug = 0;
enum eos_status { eos_undef = -2, eos_inhibited = 0, eos_present = 1,
diff --git a/tp/Texinfo/XS/xspara.h b/tp/Texinfo/XS/xspara.h
index 8352aeb35c..018480b3c1 100644
--- a/tp/Texinfo/XS/xspara.h
+++ b/tp/Texinfo/XS/xspara.h
@@ -1,4 +1,4 @@
-#include "xspara_text.h"
+#include "main/text.h"
int xspara_new (HV *conf);
void xspara_init_state (HV *hash);
diff --git a/tp/Texinfo/XS/xspara_text.c b/tp/Texinfo/XS/xspara_text.c
deleted file mode 100644
index 6fbd71b8c9..0000000000
--- a/tp/Texinfo/XS/xspara_text.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright 2014-2024 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
- #include <config.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "xspara_text.h"
-
-/* Make sure there are LEN free bytes. */
-static void
-text_alloc (TEXT *t, size_t len)
-{
- if (t->end + len > t->space)
- {
- /* FIXME: Double it instead? */
- t->space = t->end + len;
- if (t->space < 10)
- t->space = 10;
- t->text = realloc (t->text, t->space);
- if (!t->text)
- abort ();
- }
-}
-
-void
-text_printf (TEXT *t, char *format, ...)
-{
- va_list v;
- char *s;
-
- va_start (v, format);
- if (vasprintf (&s, format, v) < 0)
- abort (); /* out of memory */
- text_append (t, s);
- free (s);
- va_end (v);
-}
-
-void
-text_append_n (TEXT *t, char *s, size_t len)
-{
- text_alloc (t, len + 1);
- memcpy (t->text + t->end, s, len);
- t->end += len;
- t->text[t->end] = '\0';
-}
-
-void
-text_append (TEXT *t, char *s)
-{
- size_t len = strlen (s);
- text_append_n (t, s, len);
-}
-
-/* Set text to an empty string without clearing any storage */
-void
-text_reset (TEXT *t)
-{
- if (t->end > 0)
- {
- t->end = 0;
- t->text[0] = 0;
- }
-}
-
-void
-text_init (TEXT *t)
-{
- t->end = t->space = 0;
- t->text = 0;
-}
-
diff --git a/tp/Texinfo/XS/xspara_text.h b/tp/Texinfo/XS/xspara_text.h
deleted file mode 100644
index ac2494dada..0000000000
--- a/tp/Texinfo/XS/xspara_text.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright 2014-2024 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
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef TEXT_H
-#define TEXT_H
-
-typedef struct TEXT {
- char *text;
- size_t space;
- size_t end;
-} TEXT;
-
-void text_init (TEXT *t);
-void text_reset (TEXT *t);
-void text_append (TEXT *t, char *s);
-void text_append_n (TEXT *t, char *s, size_t len);
-void text_printf (TEXT *t, char *format, ...);
-
-#define text_base(t) ((t)->space ? (t)->text : (char *) 0)
-
-#endif