[pacman-dev] [PATCH 1/2] pacsort: correct pointer type in list_new

Dave Reisner d at falconindy.com
Mon Aug 22 09:52:01 EDT 2011


On Mon, Aug 22, 2011 at 08:41:34AM -0500, Dan McGee wrote:
> On Mon, Aug 22, 2011 at 12:00 AM, Pang Yan Han <pangyanhan at gmail.com> wrote:
> > Signed-off-by: Pang Yan Han <pangyanhan at gmail.com>
> > ---
> > Pointer sizes are the same but this makes intention clearer.
> This comment is on point enough to actually make it in the commit
> message, so I did just that.
> 

I don't agree with that point though, since the intention really is to
allocate for an array of char *, not just a char *.

dave

> >  src/util/pacsort.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/src/util/pacsort.c b/src/util/pacsort.c
> > index 109d1a1..48d183b 100644
> > --- a/src/util/pacsort.c
> > +++ b/src/util/pacsort.c
> > @@ -103,7 +103,7 @@ static struct list_t *list_new(size_t initial_size)
> >                return NULL;
> >        }
> >
> > -       list->list = calloc(initial_size, sizeof(char **));
> > +       list->list = calloc(initial_size, sizeof(char *));
> >        if(!list->list) {
> >                free(list);
> >                return NULL;
> > --
> > 1.7.6
> >
> >
> >
> 


More information about the pacman-dev mailing list