sed-devel
[Top][All Lists]
Advanced

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

Re: PATCH: use gnulib modules instead of custom code


From: Assaf Gordon
Subject: Re: PATCH: use gnulib modules instead of custom code
Date: Fri, 3 Aug 2018 20:21:41 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hello Jim,

On 02/08/18 10:09 AM, Jim Meyering wrote:
On Wed, Aug 1, 2018 at 4:52 PM, Jim Meyering <address@hidden> wrote:
On Tue, Jul 31, 2018, 08:56 Assaf Gordon <address@hidden> wrote:

Several functions in the sed codebase have equivalent modules in gnulib
(likely did not exist when the code was originally written).


In the second, I note that the removed ck_realloc function would
sometimes zero-fill an allocated buffer, yet the replacement function,
xnrealloc, never does.
[...]
As for the third, did you consider not zero-filling any of those
buffers?

As you've suspected,

second patch: replacing with xnrealloc (without zero-filling) caused no issues.

third patch: replacing with XCCALLOC (with zero-filling) is required,
as some downstream code does rely on the buffers initialized - I haven't pin-pointed which part yet, but sed crashes with just "malloc".

I've checked these using ASAN from gcc-8.2 (my later email has patches
for that).

Bottom line: with that one typo fix and given my assumption on #2, I'd
be happy if you were to push all five.

Thank you for the review.

For now, I've pushed these as is.


I will try to see if some calloc's can be changed to malloc's.
There is also the issue of the mixure of obstack/malloc - some
allocations use obstack_malloc, while others use malloc/calloc/realloc
directly.
I wonder if it will be better to unify them into one (either all obstack
or all mallocs)?
At least for the compilation stage, I would think obstack would be simpler.

regards,
 - assaf






reply via email to

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