From: Derrick Stolee <derrickstolee@github.com>
To: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH 4/4] list-objects-filter: convert filter_spec to a strbuf
Date: Mon, 19 Sep 2022 13:50:32 -0400 [thread overview]
Message-ID: <2c6fca96-6b7b-b4c4-526c-2497422d8b8f@github.com> (raw)
In-Reply-To: <Yx1sI8cjU/SWUKVy@coredump.intra.peff.net>
On 9/11/2022 1:03 AM, Jeff King wrote:
> - if (!filter_options->filter_spec.strdup_strings)
> + if (!filter_options->filter_spec.buf)
> BUG("filter_options not properly initialized");
I couldn't figure out why this would work until I dug into
STRBUF_INIT and found this:
/*
* Used as the default ->buf value, so that people can always assume
* buf is non NULL and ->buf is NUL terminated even for a freshly
* initialized strbuf.
*/
char strbuf_slopbuf[1];
So, this makes sense now.
> -#define LIST_OBJECTS_FILTER_INIT { .filter_spec = STRING_LIST_INIT_DUP }
> +#define LIST_OBJECTS_FILTER_INIT { .filter_spec = STRBUF_INIT }
And now this macro swap works, too.
Thanks,
-Stolee
next prev parent reply other threads:[~2022-09-19 17:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-11 4:57 [PATCH 0/4] list-objects-filter cleanups Jeff King
2022-09-11 4:58 ` [PATCH 1/4] list-objects-filter: don't memset after releasing filter struct Jeff King
2022-09-12 15:40 ` Junio C Hamano
2022-09-11 5:00 ` [PATCH 2/4] list-objects-filter: handle null default filter spec Jeff King
2022-09-12 16:56 ` Junio C Hamano
2022-09-11 5:03 ` [PATCH 3/4] list-objects-filter: add and use initializers Jeff King
2022-09-11 5:03 ` [PATCH 4/4] list-objects-filter: convert filter_spec to a strbuf Jeff King
2022-09-19 17:50 ` Derrick Stolee [this message]
2022-09-19 19:05 ` Jeff King
2022-09-11 5:07 ` [PATCH 0/4] list-objects-filter cleanups Jeff King
2022-09-19 17:51 ` Derrick Stolee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2c6fca96-6b7b-b4c4-526c-2497422d8b8f@github.com \
--to=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.