Re: Texinfo-7.2.91 with mingw.org's MinGW: testing (updated patch)

Gavin Smith <[email protected]>
Newsgroups gmane.comp.tex.texinfo.bugs
Message-ID <aYh7TOqlaQX977PE@orangestar>
On Sun, Feb 08, 2026 at 11:56:42AM +0000, Gavin Smith wrote:
> I have looked through the patch although have a limited understanding of
> what it does.  The following chunk looks suspect:
> 
> --- a/tta/C/convert/build_html_perl_state.c
> +++ b/tta/C/convert/build_html_perl_state.c
> @@ -158,7 +165,30 @@ build_html_translated_names (HV *converter_hv, CONVERTER *converter)
>                  strlen ("documentlanguage"), documentlanguage_sv, 0);
>      }
>  
> -  switch_perl_lang_translations (converter_hv, documentlanguage);
> +  if (documentlanguage)
> +    {
> +      if (command_line_encoding)
> +        {
> +          int status;
> +          int iconv_status = 0;
> +
> +          /* cast to drop const */
> +          encoded_lang = encode_string ((char *)documentlanguage,
> +                                        command_line_encoding,
> +                                        &status, 0, &iconv_status);
> +          if (!iconv_status)
> +            {
> +              free (encoded_lang);
> +              encoded_lang = strdup (documentlanguage);
> +            }
> +        }
> +      else
> +        encoded_lang = strdup (documentlanguage);
> +    }
> +  switch_perl_lang_translations (converter_hv, documentlanguage,
> +                                 encoded_lang);
> +
> +  free (encoded_lang);
>  
> 
> 
> 'encode_string' is in C/main/utils.c, which does not include the Perl
> headers.  Hence its return value should be allocated with the default
> libc allocator.  However, it is passed to 'free' in build_html_perl_state.c,
> which is a file which does include the Perl headers, and hence this
> will likely be a version of 'free' that uses the Perl allocator.
> 
> So the first change I would try making would be the following:

I think the first patch I sent is incomplete and won't work, here's
a fuller version:

diff --git a/tta/C/convert/build_html_perl_state.c b/tta/C/convert/build_html_perl_state.c
index ccc7663c50..3328225f91 100644
--- a/tta/C/convert/build_html_perl_state.c
+++ b/tta/C/convert/build_html_perl_state.c
@@ -43,6 +43,7 @@
 /* for html_conversion_context_type_names */
 #include "html_converter_types.h"
 #include "build_html_perl_state.h"
+#include "xs_utils.h"
 
  /* See the NOTE in build_perl_info.c on use of functions related to
     memory allocation */
@@ -184,17 +185,17 @@ build_html_translated_names (HV *converter_hv, CONVERTER *converter)
                                         &status, 0, &iconv_status);
           if (!iconv_status)
             {
-              free (encoded_lang);
-              encoded_lang = strdup (documentlanguage);
+              non_perl_free (encoded_lang);
+              encoded_lang = non_perl_strdup (documentlanguage);
             }
         }
       else
-        encoded_lang = strdup (documentlanguage);
+        encoded_lang = non_perl_strdup (documentlanguage);
     }
   switch_perl_lang_translations (converter_hv, documentlanguage,
                                  encoded_lang);
 
-  free (encoded_lang);
+  non_perl_free (encoded_lang);
 
   /* pass all the information for each context for translated commands */
   if (converter->no_arg_formatted_cmd_translated.number)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.