[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [or-cvs] Stupid sizeof operator!
- To: or-dev@freehaven.net
- Subject: Re: [or-cvs] Stupid sizeof operator!
- From: Roger Dingledine <arma@mit.edu>
- Date: Thu, 8 Apr 2004 02:48:57 -0400
- Delivered-to: archiver@seul.org
- Delivered-to: or-dev-outgoing@seul.org
- Delivered-to: or-dev@seul.org
- Delivery-date: Thu, 08 Apr 2004 02:49:15 -0400
- In-reply-to: <4074F42B.1000002@algroup.co.uk>; from ben@algroup.co.uk on Thu, Apr 08, 2004 at 07:41:47AM +0100
- References: <20040406204546.60F6033CDA@moria.seul.org> <4074F42B.1000002@algroup.co.uk>
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-dev@freehaven.net
- User-agent: Mutt/1.2.5.1i
On Thu, Apr 08, 2004 at 07:41:47AM +0100, Ben Laurie wrote:
> > Log Message:
> > Stupid sizeof operator!
> >
> > - tmp_cpath = tor_malloc_zero(sizeof(tmp_cpath));
> > + tmp_cpath = tor_malloc_zero(sizeof(crypt_path_t));
>
> Errr ... stupid coder, you mean? You wanted:
>
> tmp_cpath = tor_malloc_zero(sizeof *tmp_cpath);
No, I think sizeof(crypt_path_t) is a fine way to do it. It makes it
clearer to me that we're talking about the size of the struct, not the
size of a pointer or something.
I guess it could be a bother if tmp_cpath changes types, but I don't
think that's much of a problem.
--Roger