[pacman-dev] [PATCH] Convert payload structs from heap allocated to stack allocated

Anatol Pomozov anatol.pomozov at gmail.com
Thu Feb 20 01:46:05 UTC 2020


On Wed, Feb 12, 2020 at 12:36 AM Allan McRae <allan at archlinux.org> wrote:
> On 10/2/20 9:55 am, Anatol Pomozov wrote:
> > download_files() dynamically allocates a payload object for each
> > package. Then iterates over these payloads and calls
> > download_single_file() for it.
> >
> > This code can be simplified to iterate over package list itself.
> > payload struct can be stack allocated in this case.
> >
> > Signed-off-by: Anatol Pomozov <anatol.pomozov at gmail.com>
> > ---
> This patch looks fine (minor change below).
> However, the change from heap to stack allocated is rather unimportant.
>  Your commit message should highlight what the patch achieves.  E.g.
> Simplify construction of payloads in download_files
> Currently, download_files() creates payloads for all packages then
> iterates over them, calling download_single_file.  This can be
> simplified by looping over packages and constructing the payload as needed.

> <snip>
> > +     if(files)
> > +             alpm_list_free(files);

Fixed it and modified the description. An updated patch is sent to the maillist.

> Saying that...  it is really a limited simplification.  I assume this
> makes implementing parallel downloads easier later on.  If so, state
> that too.

Correct. It is a small part of the "parallel download" work. I've
decided to split it into separate patch and send to the list for a

More information about the pacman-dev mailing list