From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Brandon Williams <bmwill@google.com>, git@vger.kernel.org
Subject: Re: [PATCH] oidmap.h: strongly discourage using OIDMAP_INIT directly
Date: Sat, 23 Dec 2017 01:15:10 +0100 (STD) [thread overview]
Message-ID: <alpine.DEB.2.21.1.1712230112100.406@MININT-6BKU6QN.europe.corp.microsoft.com> (raw)
In-Reply-To: <xmqqlghur08f.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Fri, 22 Dec 2017, Junio C Hamano wrote:
> Brandon Williams <bmwill@google.com> writes:
>
> >> -#define OIDMAP_INIT { { NULL } }
> >> +/*
> >> + * This macro initializes the data structure only incompletely, just enough
> >> + * to call oidmap_get() on an empty map. Use oidmap_init() instead.
> >> + */
> >> +#define OIDMAP_INIT_INCOMPLETELY { { NULL } }
> >
> > This is one way of approaching the problem. Couldn't we also take the
> > approach like we have with oidset and ensure that when oidmap_get() or
> > _put() are called that if the oidmap isn't initialized, we simply do
> > that then?
>
> Hmph. Can you show how the alternative code would look like?
No, because I refuse to perform pointless work, in particular when I am
already pretty booked with work.
But you know how it would look like, right? The cmpfn() function would be
exported via oidmap.h, and a HASHMAP_INIT(cmpfn) would be introduced in
hashmap.h that would initialize everything zeroed out except for the
cmpfn.
But then you would review it and ask if there would be any use in adding
cmp_cb_data to the signature of the HASHMAP_INIT() macro, and I would have
to implement that, too.
And then nobody would use it, and the macro would very likely get
stale/incorrect. And then I would offer another patch reverting that
change (because there is no user) and replace it with this here patch.
As I said: pointless,
Dscho
next prev parent reply other threads:[~2017-12-23 0:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-22 10:59 [PATCH] oidmap.h: strongly discourage using OIDMAP_INIT directly Johannes Schindelin
2017-12-22 17:16 ` Brandon Williams
2017-12-22 20:12 ` Junio C Hamano
2017-12-22 23:27 ` [PATCH] oidmap: ensure map is initialized Brandon Williams
2017-12-23 0:23 ` Johannes Schindelin
2017-12-27 18:01 ` Junio C Hamano
2017-12-23 0:15 ` Johannes Schindelin [this message]
2018-01-02 18:13 ` [PATCH] oidmap.h: strongly discourage using OIDMAP_INIT directly Jeff Hostetler
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=alpine.DEB.2.21.1.1712230112100.406@MININT-6BKU6QN.europe.corp.microsoft.com \
--to=johannes.schindelin@gmx.de \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).