From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: Brandon Williams <bmwill@google.com>,
"git@vger.kernel.org" <git@vger.kernel.org>,
Johannes Sixt <j6t@kdbg.org>,
Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCHv3] attr: convert to new threadsafe API
Date: Tue, 18 Oct 2016 17:06:55 -0700 [thread overview]
Message-ID: <CAPc5daVF2HBD2DfP=w2oG-2PMWQ+guXP_onQX+foSgVYH4N1Qg@mail.gmail.com> (raw)
In-Reply-To: <CAGZ79kbS4mP7sVTCM+QJXTwKsgZ40xvVDng-F3igZnJWLYek0A@mail.gmail.com>
On Tue, Oct 18, 2016 at 4:52 PM, Stefan Beller <sbeller@google.com> wrote:
>
> >
> > By the way, I do see a merit on the "check" side (tl;dr: but I do
> > not think "result" needs it, hence I do not see the need for the
> > "ugly" variants).
>
> So we'd rather go with const char **result instead of our own new struct there.
> Ok, got it.
I do not think you got it. I am talking about wrapping struct around
an array of element,
not each element in the array. IOW
> > If we were still to do the wrapping for result, I would say that
> > basing it around the FLEX_ARRAY idiom, i.e.
> >
> >> struct git_attr_result {
> >> int num_slots;
> >> const char *value[FLEX_ARRAY];
> >> };
the structure around the array of elements (value) that allows us to have
something other than value[] in it. That is what I said "I do not see
the need for".
It is perfectly fine future-proofing to have
struct git_attr_result_value {
const char *value;
};
and have the users of API declare
struct git_attr_result value[5];
or whatever. That way we could fatten the structure later if we wanted
to without having to update the users of API, and there is no downside.
Having wrapping strut around the array does have a huge downside,
and that is what I said I see no need for.
next prev parent reply other threads:[~2016-10-19 0:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-12 22:41 [PATCHv3] attr: convert to new threadsafe API Stefan Beller
2016-10-12 23:33 ` Junio C Hamano
2016-10-13 18:42 ` Stefan Beller
2016-10-13 22:08 ` Stefan Beller
2016-10-14 15:37 ` Junio C Hamano
2016-10-18 23:52 ` Stefan Beller
2016-10-19 0:06 ` Junio C Hamano [this message]
2016-10-19 0:20 ` Stefan Beller
2016-10-19 0:40 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPc5daVF2HBD2DfP=w2oG-2PMWQ+guXP_onQX+foSgVYH4N1Qg@mail.gmail.com' \
--to=gitster@pobox.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=jacob.keller@gmail.com \
--cc=sbeller@google.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).