Re: [PATCH] Fix a bunch of pointer declarations (codestyle)
- From
Jeff King <peff@peff.net>
- Date
- May 1, 2009, 20:39 UTC
- Message-ID
- <20090501203910.GA15549@coredump.intra.peff.net>
- In-Reply-To
- <780e0a6b0905011220g42d9784dp186cc7ff7669081e@mail.gmail.com>
On Fri, May 01, 2009 at 12:20:08PM -0700, Stephen Boyd wrote:
Show 10 quoted lines
> On Fri, May 1, 2009 at 2:06 AM, Felipe Contreras > <felipe.contreras@gmail.com> wrote: > > > > - *argv = xmalloc(sizeof(char*) * size); > > + *argv = xmalloc(sizeof(char *) * size); > > > > I don't think this is what the coding guidelines is talking about. A > pointer isn't being declared here plus there isn't any variable the > star should be sticking to.
Besides that, don't we usually prefer sizeof() on the actual variable instead of the type, which is less error prone? IOW,
*argv = xmalloc(sizeof(**argv) * size);
-Peff