[hipl-dev] Re: [Merge] lp:~diego-biurrun/hipl/calloc into lp:hipl

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-dev@xxxxxxxxxxxxx
  • Date: Mon, 10 Jan 2011 16:01:24 +0100

On Mon, Jan 10, 2011 at 11:56:56AM +0000, Stefan Götz wrote:
> Scope of this branch
> --------------------
> Given that this code is being touched now, it would be great to get
> rid of pointless zeroing, e.g., where a zeroed data structure is
> allocated only to be initialized right away with other data or be
> memcpy()ied over.

I have another branch that looks into some other memsets, I'll extend
its scope to look at callocs as well.  But I will push this branch
right away in order not to collect too many local changes.

> Review
> ------
> 
> > 643 === modified file 'lib/core/performance.c'
> > 644 --- lib/core/performance.c 2011-01-04 16:22:49 +0000
> > 645 +++ lib/core/performance.c 2011-01-10 10:39:56 +0000
> > 646 @@ -59,32 +59,18 @@
> 
> > 677 + set->files = calloc(1, sizeof(FILE *) * num);
> > 678 + set->names = calloc(1, sizeof(char *) * num);
> > 679 + set->linecount = calloc(1, sizeof(int) * num);
> > 680 + set->times = calloc(1, sizeof(struct timeval) * num);
> > 681 + set->result = calloc(1, sizeof(double) * num);
> > 682 + set->running = calloc(1, sizeof(int) * num);
> > 683 + set->writable = calloc(1, sizeof(int) * num);
> 
> Style: given the signature of calloc(), 'calloc(num, sizeof(type))' seems 
> more natural to me.

Good point, will fix.

Diego

Other related posts: