[pacman-dev] [PATCH] Copy pmdelta_t objects in _alpm_pkg_dup().

Dan McGee dpmcgee at gmail.com
Mon Oct 29 22:49:48 EDT 2007


On 10/29/07, Nathan Jones <nathanj at insightbb.com> wrote:
> On Mon, Oct 29, 2007 at 09:00:47PM -0500, Dan McGee wrote:
> > On 10/29/07, Nathan Jones <nathanj at insightbb.com> wrote:
> > > _alpm_pkg_dup() should create copies of all objects inside the pmpkg_t
> > > struct. I missed this function when adding the delta list to pmpkg_t.
> > >
> > > Signed-off-by: Nathan Jones <nathanj at insightbb.com>
> >
> >
> > How about this instead?
>
> Fine with me. I mainly wrote it that way to avoid breaking #6 in
> HACKING.

For everyones reference (and boy am I glad someone actually read this!):

6.  The sizeof() operator should accept a type, not a value. (TODO: in certain
    cases, it may be better- should this be a set guideline? Read "The Practice
    of Programming")

    sizeof(alpm_list_t);
       NOT
    sizeof(*mylist);

This is the exception case. Not really another way to do it, and as
long as you follow the warning that the size must be known beforehand
(static), you are fine. People get in trouble when they start doing it
on strings, etc.

Nathan- keep up the great work. Glad to have you contributing!

-Dan




More information about the pacman-dev mailing list