Re: [PATCH 3/3] test-parse-options: --expect=<string> option to simplify tests
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 6, 2016, 17:34 UTC
- Message-ID
- <xmqqinyr3xbj.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <CAGZ79kZ59K5BoSVsbt4YM-Try9Q1CVdFeBW8GE5E1dJpSBWzVA@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
Show 13 quoted lines
>> + if (!item)
>> + ; /* not among entries being checked */
>> + else {
>> + if (strcmp((const char *)item->util, buf.buf)) {
>> + printf("expected '%s', got '%s'\n",
>> + (char *)item->util, buf.buf);
>> + *status = 1;
>> + }
>> + }
>> + }
>> + strbuf_reset(&buf);
>
> strbuf_release ?Thanks for spotting a leak.
I originally had the buf as static, as all generated strings are short and of similar length, in an attempt to reuse the already allocated storage instead of allocating it from scratch every call.
>> >> return 0; > > return ret; ? Otherwise `ret` is unused.
This, too. Thanks.