I read the relevant chapter in the GNU Lididn manual[1] that probably lead
you to write that ifdef. Really: those look like the kind of cerebral
digressions of people that have lot of time to waste. All serious
cross-platforms C libraries wraps alloc/free functions wherever it's the
right thing to do. Cluttering one's user code with ifdefs because of a
single free function that on non WIN32 just calls free() is just not worth
the cost in readability of the code so I also recommend to use idn_free()
unconditionally, if it's safe to do so. If performance was a concern here
(it's not) they could have just provided a macro with a conditional
different behavior in the header.

[1]
https://www.gnu.org/software/libidn/manual/libidn.html#Memory-handling-under-Windows

On Wed, 2 Feb 2022 at 18:14, Andreas Brzesowsky <andreas.brzesow...@dots.de>
wrote:

> Hi,
>
> yes, it's possible to always call idn_free. Changed this with attached
> patch.
> But only in Windows it is necessary to use this function, because of the
> heap concept of Windows.
> So the same reason why use podofo_free that always calls just free in the
> context of the module.
>
> Regards
>
> Andy
>
> Am 01.02.2022 um 08:33 schrieb zyx:
>
> On Mon, 2022-01-31 at 17:59 +0100, Andreas Brzesowsky wrote:
>
> +#ifdef _WIN32
> +    // In Windows the libidn.dll could use an other heap and then
> the normal free will crash.
> +    idn_free(password_sasl);
> +#else
>
>       Hi,
> would it make sense to always call the right function, not only
> sometimes? If the two can differ, no matter if only sometimes or
> always, then I'd say it's better to always use the right function.
>
> Pity the stringprep_profile() man page does not specify what function
> should be used to free the output buffer.
>
> It seems the idn_free() calls just free() on Linux, thus it might be
> possible to use that function unconditionally.
>       Bye,
>       zyx
>
>
>
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to