Re: [PATCH v15 13/27] bisect--helper: `bisect_start` shell function partially in C
- From
Stephan Beyer <s-beyer@gmx.net>
- Date
- Nov 20, 2016, 20:19 UTC
- Message-ID
- <de42ba9d-af15-6d77-5c97-4136b7aad149@gmx.net>
- In-Reply-To
- <52f6241f-e584-d830-ca66-084dc509c7fe@gmx.net>
On 11/20/2016 09:01 PM, Stephan Beyer wrote:
Show 10 quoted lines
> First, replace the current set_terms() by
>
> static void set_terms(struct bisect_terms *terms, const char *bad,
> const char *good)
> {
> terms->term_good = xstrdup(good);
> terms->term_bad = xstrdup(bad);
> }
>
> ie, without calling write_terms(...).I did not want to confuse you here but I forgot to mention that there should also be freeing code, i.e. initialize your terms to NULL in the beginning of cmd_builtin__helper, and always free them if it is not null. This freeing code could also be in an extra function free_terms() and you call it in set_terms() and for cleanup in the end.