[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Texinfo 6.7 released
From: |
Gavin Smith |
Subject: |
Re: Texinfo 6.7 released |
Date: |
Sat, 28 Sep 2019 11:20:29 +0100 |
> Maybe that's what we should do here as well. 'free' is a macro
> expanded into something implemented inside Perl, right? And asprintf
> comes from Gnulib on MS-Windows, right? So we have that problem I
> mentioned with allocation and free that come from different libraries.
Yes, that makes sense.
> I needed to add dTHX to 'init', or it wouldn't compile.
Didn't it compile before?
> So it looks like it indeed crashes when calling 'free' on storage
> allocated by asprintf. With that in mind, I modified api.c as below:
>
> --- ./tp/Texinfo/XS/parsetexi/api.c.~1~ 2019-08-25 20:11:45.000000000 +0300
> +++ ./tp/Texinfo/XS/parsetexi/api.c 2019-09-28 10:50:13.319625000 +0300
> @@ -56,7 +56,8 @@ find_locales_dir (char *builddir)
>
> dTHX;
>
> - asprintf (&s, "%s/LocaleData", builddir);
> + s = malloc (strlen (builddir) + strlen ("/LocaleData") + 1);
> + sprintf (s, "%s/LocaleData", builddir);
> dir = opendir (s);
> if (!dir)
> {
>
>
> and the problem went away.
Would you like to commit that change?
I don't know of a good way to avoid using the Perl version of free.
You could have "#undef free" followed by "#define free PerlMem_free",
but this would break if perl changes the way that it overrides "free".
> If this is the right fix, then I think we
> cannot use Gnulib's asprintf in Parsetexi, and there are a couple of
> other places with the same problem, which we need to fix as well,
> right?
Hopefully not: only if Perl headers are included in a file should
there be problems. I believe you successfully built and used the
Parsetexi module before on MS-Windows when asprintf was used in other
files.
I deliberately limited where the Perl headers were included: for
example, in tree_types.h a field of a struct is declared as a void
pointer rather than the Perl type it should be. The files where there
could be problems are api.c and Parsetexi.xs: it shouldn't be too hard
to avoid using asprintf there (or other functions which use the real
version of malloc).
- Re: Texinfo 6.7 released, (continued)
- Re: Texinfo 6.7 released, Eli Zaretskii, 2019/09/27
- Re: Texinfo 6.7 released, Gavin Smith, 2019/09/27
- Re: Texinfo 6.7 released, Eli Zaretskii, 2019/09/27
- Re: Texinfo 6.7 released, Eli Zaretskii, 2019/09/27
- Re: Texinfo 6.7 released, Gavin Smith, 2019/09/27
- Re: Texinfo 6.7 released, Eli Zaretskii, 2019/09/28
- Re: Texinfo 6.7 released, Gavin Smith, 2019/09/28
- Re: Texinfo 6.7 released, Eli Zaretskii, 2019/09/28
- Re: Texinfo 6.7 released, Gavin Smith, 2019/09/27
- Re: Texinfo 6.7 released, Eli Zaretskii, 2019/09/28
- Re: Texinfo 6.7 released,
Gavin Smith <=
- Re: Texinfo 6.7 released, Eli Zaretskii, 2019/09/28
- Re: Texinfo 6.7 released, Eli Zaretskii, 2019/09/28