texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/convert/ConvertXS.xs (html_set_sh


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/ConvertXS.xs (html_set_shared_conversion_state, html_get_shared_conversion_state), tp/Texinfo/XS/convert/build_html_perl_state.c (build_html_translated_names): do not used perl_only_* wrappers as the files do not include Gnulib headers anymore.
Date: Sat, 16 Nov 2024 05:37:20 -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 f512bc1e52 * tp/Texinfo/XS/convert/ConvertXS.xs 
(html_set_shared_conversion_state, html_get_shared_conversion_state), 
tp/Texinfo/XS/convert/build_html_perl_state.c (build_html_translated_names): do 
not used perl_only_* wrappers as the files do not include Gnulib headers 
anymore.
f512bc1e52 is described below

commit f512bc1e5222389ba3388df8e8f37aea9b29f771
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Nov 16 11:35:49 2024 +0100

    * tp/Texinfo/XS/convert/ConvertXS.xs
    (html_set_shared_conversion_state, html_get_shared_conversion_state),
    tp/Texinfo/XS/convert/build_html_perl_state.c
    (build_html_translated_names): do not used perl_only_* wrappers as the
    files do not include Gnulib headers anymore.
---
 ChangeLog                                     |  8 ++++++++
 tp/Texinfo/XS/convert/ConvertXS.xs            |  8 ++++----
 tp/Texinfo/XS/convert/build_html_perl_state.c |  7 ++++---
 tp/Texinfo/XS/main/build_perl_info.c          | 24 ++++++++++++++++++------
 4 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a01250a8a4..df1f55b244 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-11-16  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/ConvertXS.xs
+       (html_set_shared_conversion_state, html_get_shared_conversion_state),
+       tp/Texinfo/XS/convert/build_html_perl_state.c
+       (build_html_translated_names): do not used perl_only_* wrappers as the
+       files do not include Gnulib headers anymore.
+
 2024-11-16  Gavin Smith <gavinsmith0123@gmail.com>
 
        Use $PERL to run Perl
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 2564c86278..460966400f 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -2302,7 +2302,7 @@ html_set_shared_conversion_state (SV *converter_in, 
cmdname, state_name, ...)
         if (args_nr > 0)
           {
             int i;
-            args_sv = (SV **) perl_only_malloc (args_nr * sizeof (SV *));
+            args_sv = (SV **) malloc (args_nr * sizeof (SV *));
             for (i = 0; i < args_nr; i++)
               {
                 args_sv[i] = ST(i+3);
@@ -2310,7 +2310,7 @@ html_set_shared_conversion_state (SV *converter_in, 
cmdname, state_name, ...)
           }
         html_set_shared_conversion_state (self, converter_in,
                                cmdname, state_name, args_nr, args_sv);
-        perl_only_free (args_sv);
+        free (args_sv);
 
 SV *
 html_get_shared_conversion_state (SV *converter_in, cmdname, state_name, ...)
@@ -2327,7 +2327,7 @@ html_get_shared_conversion_state (SV *converter_in, 
cmdname, state_name, ...)
         if (args_nr > 0)
           {
             int i;
-            args_sv = (SV **) perl_only_malloc (args_nr * sizeof (SV *));
+            args_sv = (SV **) malloc (args_nr * sizeof (SV *));
             for (i = 0; i < args_nr; i++)
               {
                 args_sv[i] = ST(i+3);
@@ -2335,7 +2335,7 @@ html_get_shared_conversion_state (SV *converter_in, 
cmdname, state_name, ...)
           }
         RETVAL = html_get_shared_conversion_state (self, converter_in,
                                     cmdname, state_name, args_nr, args_sv);
-        perl_only_free (args_sv);
+        free (args_sv);
     OUTPUT:
         RETVAL
 
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c 
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index 6f659df2f6..68c52cb113 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -14,6 +14,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <stdio.h>
+#include <stdlib.h>
 
 /* Avoid namespace conflicts. */
 #define context perl_context
@@ -37,7 +38,7 @@
 #include "debug.h"
 #include "convert_to_texinfo.h"
  */
-/* newSVpv_utf8 element_to_perl_hash perl_only_* wrappers */
+/* newSVpv_utf8 element_to_perl_hash */
 #include "build_perl_info.h"
 /* for html_conversion_context_type_names translated_special_unit_info
    special_unit_info_type_names */
@@ -82,11 +83,11 @@ build_html_translated_names (HV *hv, CONVERTER *converter)
       const char *type_name = special_unit_info_type_names[string_type];
       char *key;
       HV *special_unit_hv = newHV ();
-      key = perl_only_malloc (strlen (type_name) + strlen ("_tree") + 1);
+      key = malloc (strlen (type_name) + strlen ("_tree") + 1);
       sprintf (key, "%s_tree", type_name);
       hv_store (special_unit_info_hv, key, strlen (key),
                 newRV_noinc ((SV *) special_unit_hv), 0);
-      perl_only_free (key);
+      free (key);
     }
 
   /* pass all the information for each context for translated commands */
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index 40a3049f3c..bb6f08853c 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -96,25 +96,37 @@
 
    /* 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.
-
-      To be sure to use Perl defined functions, wrappers
-      can be used, from build_perl_info.h:
-       perl_only_free, perl_only_strdup, perl_only_strndup, perl_only_malloc.
+      free or allocate in other files using Gnulib definitions.
 
       To be sure to use non Perl defined functions, constructors and wrappers
-      can be used, from utils.h:
+      must be used, from xs_utils.h:
        non_perl_free, non_perl_malloc, non_perl_strdup, non_perl_strndup,
        non_perl_xvasprintf, non_perl_xasprintf.
+
+      This is often needed, when memory is allocated or free'd in
+      'pure' C code (code that does not include Perl headers), as it is
+      safer to assume that Gnulib is always used in 'pure' C code.
+
+      To be sure to use Perl defined functions in files that include
+      both Gnulib and Perl headers, wrappers can be used, from
+      build_perl_info.h:
+       perl_only_free, perl_only_strdup, perl_only_strndup, perl_only_malloc.
+
+      In November 2024, no file is compiled with both Perl and Gnulib
+      headers as it lead to many errors on MS-Windows, therefore the
+      perl_only_* wrappers are currently unused.
+
     */
 
 /* wrappers to be sure to use Perl defined functions */
+/* NB this function does not appear to be used currently. */
 void
 perl_only_free (void *ptr)
 {
   free (ptr);
 }
 
+/* NB this function does not appear to be used currently. */
 void *
 perl_only_malloc (size_t size)
 {



reply via email to

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