Re: /bzr/squid3/trunk/ r11938: Implemented and made public StatHist copy-constructor

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Mon, 09 Jan 2012 13:26:54 -0700

On 12/17/2011 02:23 PM, Francesco Chemolli wrote:
> ------------------------------------------------------------
> revno: 11938
> committer: Francesco Chemolli <kinkie_at_squid-cache.org>
> branch nick: trunk
> timestamp: Sat 2011-12-17 22:23:14 +0100
> message:
> Implemented and made public StatHist copy-constructor

> StatHist::StatHist(const StatHist &src) :
> capacity_(src.capacity_), min_(src.min_), max_(src.max_),
> scale_(src.scale_), val_in(src.val_in), val_out(src.val_out)
> {
> if (src.bins!=NULL) {
> bins = static_cast<int *>(xcalloc(src.capacity_, sizeof(int)));
> memcpy(bins,src.bins,capacity_*sizeof(*bins));
> }
> }

Please initialize bins if src.bins are NULL or, instead of the
if-condition, assert that src.bins are not NULL.

Thank you,

Alex.
Received on Mon Jan 09 2012 - 20:27:19 MST

This archive was generated by hypermail 2.2.0 : Tue Jan 10 2012 - 12:00:04 MST