Re: [PATCH 11/23] fsmonitor--daemon: define token-ids
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Apr 26, 2021, 20:01 UTC
- Message-ID
- <CAPig+cSNJYh-cTxghPiaAxKhYENDKbYO8jrdvoBsB3Eq0GYWjA@mail.gmail.com>
- In-Reply-To
- <3f0c5c7d-8448-15ec-9e12-b2745d7bbf2b@gmail.com>
On Mon, Apr 26, 2021 at 3:49 PM Derrick Stolee <stolee@gmail.com> wrote:
Show 9 quoted lines
> On 4/1/2021 11:40 AM, Jeff Hostetler via GitGitGadget wrote: > > + token = (struct fsmonitor_token_data *)xcalloc(1, sizeof(*token)); > > I think the best practice here is "CALLOC_ARRAY(token, 1);" > > > + > > + strbuf_init(&token->token_id, 0); > > This is likely overkill since you used calloc() above.
Not quite. A strbuf must be initialized either with STRBUF_INIT or strbuf_init() in order to make strbuf.buf point at strbuf_slopbuf.