Re: [RFC PATCH 2/2] Replace calls to strbuf_init(&foo, 0) with static STRBUF_INIT initializer
- From
Alex Riesen <raa.lkml@gmail.com>
- Date
- Oct 9, 2008, 21:28 UTC
- Message-ID
- <81b0412b0810091428o6a4ea772q6a10cd295e4fcd7d@mail.gmail.com>
- In-Reply-To
- <UUi8gSMV6CruoYIkVNOQZ4FNzsbqZcSNu6jdYH8GqIo@cipher.nrlssc.navy.mil>
2008/10/9 Brandon Casey <casey@nrlssc.navy.mil>:
Show 11 quoted lines
> Many call sites use strbuf_init(&foo, 0) to initialize local strbuf variable > "foo" which has not been accessed since its declaration. These can be > replaced with a static initialization using the STRBUF_INIT macro which is > just as readable, saves a function call, and takes up fewer lines. > > Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> > --- > > > This does the same thing for strbuf_init() that the last one did for memset(). >
But it does this using a predefined interface (using the STRBUG_INIT macro), so next time strbuf changed, the code using it may be left as is.
I didn't like the memset->zero-init, but I do like this one. It is a bit unclear, by the way, why strbuf_init wasn't inlined.