texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/XS/main/DocumentXS.xs, tp/Texinfo/XS


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/main/DocumentXS.xs, tp/Texinfo/XS/main/IndicesXS.xs, tp/Texinfo/XS/main/build_perl_info.c, tp/Texinfo/XS/main/call_perl_function.c, tp/Texinfo/XS/main/get_perl_info.c, tp/maintain/regenerate_C_options_info.pl: remove code avoiding redefinition by gnulib as gnulib headers are not included. Update comments.
Date: Sun, 25 Feb 2024 17:24:49 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 378278a4ae * tp/Texinfo/XS/main/DocumentXS.xs, 
tp/Texinfo/XS/main/IndicesXS.xs, tp/Texinfo/XS/main/build_perl_info.c, 
tp/Texinfo/XS/main/call_perl_function.c, tp/Texinfo/XS/main/get_perl_info.c, 
tp/maintain/regenerate_C_options_info.pl: remove code avoiding redefinition by 
gnulib as gnulib headers are not included.  Update comments.
378278a4ae is described below

commit 378278a4aef38451624693113b3b320713a247de
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Feb 25 23:24:41 2024 +0100

    * tp/Texinfo/XS/main/DocumentXS.xs, tp/Texinfo/XS/main/IndicesXS.xs,
    tp/Texinfo/XS/main/build_perl_info.c,
    tp/Texinfo/XS/main/call_perl_function.c,
    tp/Texinfo/XS/main/get_perl_info.c,
    tp/maintain/regenerate_C_options_info.pl: remove code avoiding
    redefinition by gnulib as gnulib headers are not included.  Update
    comments.
    
    * tp/Texinfo/XS/Makefile.am (DocumentXS_la_L*, ConvertXS_la_LIBADD):
    add libgnu.la and $(LTLIBICONV) $(LTLIBUNISTRING) is not there for
    XS that are likely to use code related to those libraries.
    
    * tp/Texinfo/XS/Makefile.am (IndicesXS_la_CPPFLAGS): remove gnulib
    includes, they are not needed.
---
 ChangeLog                                | 17 +++++++++++++++
 tp/TODO                                  |  4 ++++
 tp/Texinfo/XS/Makefile.am                |  8 +++----
 tp/Texinfo/XS/main/DocumentXS.xs         |  3 ---
 tp/Texinfo/XS/main/IndicesXS.xs          |  3 ---
 tp/Texinfo/XS/main/build_perl_info.c     | 37 +++++++++++++++-----------------
 tp/Texinfo/XS/main/call_perl_function.c  | 11 ++--------
 tp/Texinfo/XS/main/get_perl_info.c       |  9 ++------
 tp/maintain/regenerate_C_options_info.pl |  8 +++----
 9 files changed, 49 insertions(+), 51 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dcf4761e33..7ea2cf0f24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-02-25  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/DocumentXS.xs, tp/Texinfo/XS/main/IndicesXS.xs,
+       tp/Texinfo/XS/main/build_perl_info.c,
+       tp/Texinfo/XS/main/call_perl_function.c,
+       tp/Texinfo/XS/main/get_perl_info.c,
+       tp/maintain/regenerate_C_options_info.pl: remove code avoiding
+       redefinition by gnulib as gnulib headers are not included.  Update
+       comments.
+
+       * tp/Texinfo/XS/Makefile.am (DocumentXS_la_L*, ConvertXS_la_LIBADD):
+       add libgnu.la and $(LTLIBICONV) $(LTLIBUNISTRING) is not there for
+       XS that are likely to use code related to those libraries.
+
+       * tp/Texinfo/XS/Makefile.am (IndicesXS_la_CPPFLAGS): remove gnulib
+       includes, they are not needed.
+
 2024-02-25  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/errors.c (message_list_line_formatted_message)
diff --git a/tp/TODO b/tp/TODO
index 0946822000..4d09ac5c51 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -11,6 +11,10 @@ Before next release
 ===================
 
 
+Add a TODO FIXME near reset_parser_counters in parsetexi/parser.c to
+remember that there should be debug messages for counters that were
+reset but should not have to be and there is a likely bug..
+
 Bugs
 ====
 
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index 2c6d40fbd1..c4fec049fd 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -339,8 +339,8 @@ EXTRA_DIST += main/DocumentXS.xs
 # locate include files under out-of-source builds.
 DocumentXS_la_CPPFLAGS = -I$(srcdir)/main $(AM_CPPFLAGS) $(XSLIBS_CPPFLAGS)
 DocumentXS_la_CFLAGS = $(XSLIBS_CFLAGS)
-DocumentXS_la_LIBADD = libtexinfoxs.la libtexinfo.la
-DocumentXS_la_LDFLAGS = $(XSLIBS_LDFLAGS)
+DocumentXS_la_LIBADD = libtexinfoxs.la libtexinfo.la 
$(top_builddir)/gnulib/lib/libgnu.la
+DocumentXS_la_LDFLAGS = $(XSLIBS_LDFLAGS) $(LTLIBICONV) $(LTLIBUNISTRING)
 
 ########################## StructuringTransfo XS
 
@@ -378,7 +378,7 @@ CLEANFILES += \
 EXTRA_DIST += main/IndicesXS.xs
 
 # locate include files under out-of-source builds.
-IndicesXS_la_CPPFLAGS = -I$(srcdir)/main $(AM_CPPFLAGS) $(GNULIB_CPPFLAGS) 
$(XSLIBS_CPPFLAGS)
+IndicesXS_la_CPPFLAGS = -I$(srcdir)/main $(AM_CPPFLAGS) $(XSLIBS_CPPFLAGS)
 IndicesXS_la_CFLAGS = $(XSLIBS_CFLAGS)
 IndicesXS_la_LIBADD = libtexinfoxs.la libtexinfo.la 
$(top_builddir)/gnulib/lib/libgnu.la
 IndicesXS_la_LDFLAGS = $(XSLIBS_LDFLAGS) $(LTLIBICONV) $(LTLIBUNISTRING)
@@ -409,7 +409,7 @@ EXTRA_DIST += convert/ConvertXS.xs
 # To locate include files under out-of-source builds.
 ConvertXS_la_CPPFLAGS = -I$(srcdir)/main -I$(srcdir)/structuring_transfo 
-I$(srcdir)/convert $(AM_CPPFLAGS) $(GNULIB_CPPFLAGS) $(XSLIBS_CPPFLAGS)
 ConvertXS_la_CFLAGS = $(XSLIBS_CFLAGS)
-ConvertXS_la_LIBADD = libtexinfoxs.la libtexinfo.la
+ConvertXS_la_LIBADD = libtexinfoxs.la libtexinfo.la 
$(top_builddir)/gnulib/lib/libgnu.la
 ConvertXS_la_LDFLAGS = $(XSLIBS_LDFLAGS) $(LTLIBICONV) $(LTLIBUNISTRING)
 
 
diff --git a/tp/Texinfo/XS/main/DocumentXS.xs b/tp/Texinfo/XS/main/DocumentXS.xs
index 9443a0c0db..2d051fcef1 100644
--- a/tp/Texinfo/XS/main/DocumentXS.xs
+++ b/tp/Texinfo/XS/main/DocumentXS.xs
@@ -21,9 +21,6 @@
 #define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
 #include "perl.h"
-#if defined _WIN32 && !defined __CYGWIN__
-# undef free
-#endif
 #include "XSUB.h"
 
 #undef context
diff --git a/tp/Texinfo/XS/main/IndicesXS.xs b/tp/Texinfo/XS/main/IndicesXS.xs
index 7acd3e9803..94ef051f5a 100644
--- a/tp/Texinfo/XS/main/IndicesXS.xs
+++ b/tp/Texinfo/XS/main/IndicesXS.xs
@@ -21,9 +21,6 @@
 #define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
 #include "perl.h"
-#if defined _WIN32 && !defined __CYGWIN__
-# undef free
-#endif
 #include "XSUB.h"
 
 #undef context
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index 3fff0a4b74..b63fe70e02 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -21,11 +21,6 @@
 #define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
 #include "perl.h"
-/* Avoid warnings about Perl headers redefining symbols that gnulib
-   redefined already. */
-#if defined _WIN32 && !defined __CYGWIN__
-  #undef free
-#endif
 #include "XSUB.h"
 
 #undef context
@@ -57,21 +52,23 @@
 
 #define LOCALEDIR DATADIR "/locale"
 
-  /* TODO the following NOTE could be obsolete, as this code is now part
-     of a library that is not linked against Gnulib.  However, XS dynamic
-     shared object link against both the library this code is part of and
-     another library that does not use perl headers and do not link against
-     perl libraries but links against Gnulib. */
-
-  /* NOTE: Do not call 'malloc' or 'free' in any function called in this file.
-     Since this file (build_perl_info.c) includes the Perl headers,
-     we get the Perl redefinitions, which we do not want, as we don't use
-     them throughout the rest of the program. */
-
-  /* Can't use asprintf here, because it might come from Gnulib, and
-     will then use malloc that is different from Perl's malloc, whereas
-     free below is redirected to Perl's implementation.  This could
-     cause crashes if the two malloc/free implementations were different.  */
+  /* NOTE This file includes the Perl headers, therefore we get the Perl
+     redefinitions of functions related to memory allocation, such as
+     'free', 'malloc', 'strdup' or 'asprintf'. In other files, the Gnulib
+     redefinition of those functions are used. It is wrong to mix functions
+     from Perl and Gnulib. If memory is allocated with Gnulib defined malloc,
+     and then freed with Perl defined free (or vice versa), then an error
+     can occur like "Free to wrong pool".
+    https://lists.gnu.org/archive/html/bug-texinfo/2016-01/msg00016.html
+   */
+
+   /* Functions defined in files with Gnulib definition should therefore
+      be used to allocate or free to match with the functions used to
+      free or allocate in files using Gnulib definitions.
+
+      TODO say something about wrappers.
+    */
+
 
 int
 init (int texinfo_uninstalled, char *builddir)
diff --git a/tp/Texinfo/XS/main/call_perl_function.c 
b/tp/Texinfo/XS/main/call_perl_function.c
index d8b942137f..2c4a2eeb19 100644
--- a/tp/Texinfo/XS/main/call_perl_function.c
+++ b/tp/Texinfo/XS/main/call_perl_function.c
@@ -21,11 +21,6 @@
 #define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
 #include "perl.h"
-/* Avoid warnings about Perl headers redefining symbols that gnulib
-   redefined already. */
-#if defined _WIN32 && !defined __CYGWIN__
-  #undef free
-#endif
 #include "XSUB.h"
 
 #undef context
@@ -38,10 +33,8 @@
 #include "build_perl_info.h"
 #include "call_perl_function.h"
 
- /* The NOTE in build_perl_info.c about not using malloc/free should
-    be relevant for this file
-    TODO there are calls to strndup.  Is it ok?
-  */
+ /* See the NOTE in build_perl_info.c on use of functions related to
+    memory allocation */
 
 char *
 call_nodenamenormalization_unicode_to_transliterate (const char *text)
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index ba986dc450..e51346a972 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -21,11 +21,6 @@
 #define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
 #include "perl.h"
-/* Avoid warnings about Perl headers redefining symbols that gnulib
-   redefined already. */
-#if defined _WIN32 && !defined __CYGWIN__
-  #undef free
-#endif
 #include "XSUB.h"
 
 #include "ppport.h"
@@ -48,8 +43,8 @@
 #include "converter.h"
 #include "get_perl_info.h"
 
- /* TODO the NOTE in build_perl_info.c about not using malloc/free should
-    be relevant for this file */
+ /* See the NOTE in build_perl_info.c on use of functions related to
+    memory allocation */
 
 #define FETCH(key) key##_sv = hv_fetch (element_hv, #key, strlen(#key), 0);
 
diff --git a/tp/maintain/regenerate_C_options_info.pl 
b/tp/maintain/regenerate_C_options_info.pl
index 0e31902e23..dd06adefbd 100755
--- a/tp/maintain/regenerate_C_options_info.pl
+++ b/tp/maintain/regenerate_C_options_info.pl
@@ -266,15 +266,13 @@ print GET '
 #define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
 #include "perl.h"
-/* Avoid warnings about Perl headers redefining symbols that gnulib
-   redefined already. */
-#if defined _WIN32 && !defined __CYGWIN__
-  #undef free
-#endif
 #include "XSUB.h"
 
 #undef context
 
+ /* See the NOTE in build_perl_info.c on use of functions related to
+    memory allocation */
+
 ';
 
 # FIXME include before or after perl?  Include config.h?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]