From: Eric Wong <e@80x24.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Derrick Stolee <stolee@gmail.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [PATCH v3 21/20] convert: drop invalid comment for subprocess_entry
Date: Tue, 8 Oct 2019 02:56:41 +0000 [thread overview]
Message-ID: <20191008025641.zinxoqsrncgzyjcq@dcvr> (raw)
In-Reply-To: <xmqq4l0koucn.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> wrote:
> Eric Wong <e@80x24.org> writes:
>
> > "struct hashmap_entry" inside "struct subprocess_entry"
> > no longer needs to be the first member of any struct,
> > so the old comment is no longer true.
>
> Hmm, is that true?
>
> struct cmd2process {
> struct subprocess_entry subprocess;
> unsigned int supported_capabilities;
> };
>
> static int start_multi_file_filter_fn(struct subprocess_entry *subprocess)
> {
> static int versions[] = {2, 0};
> static struct subprocess_capability capabilities[] = {
> { "clean", CAP_CLEAN },
> { "smudge", CAP_SMUDGE },
> { "delay", CAP_DELAY },
> { NULL, 0 }
> };
> struct cmd2process *entry = (struct cmd2process *)subprocess;
> return subprocess_handshake(subprocess, "git-filter", versions, NULL,
> capabilities,
> &entry->supported_capabilities);
> }
>
> The cast "struct subprocess_entry *" to "struct cmd2process *" we
> see here does require that the address of the subprocess field must
> be the same as the address of the structure itself. So I'd have to
> say that the comment still is true, but not for the reasons of what
> is in "struct subprocess_entry".
Oops, right. Let's just leave it at 20 patches for this series
and skip this one, for now.
I seem to recall there's a bunch of places where we do casts
like that which could be rewritten more flexibly with container_of.
next prev parent reply other threads:[~2019-10-08 2:56 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-06 23:30 [PATCH v3 00/20] hashmap bug/safety/ease-of-use fixes Eric Wong
2019-10-06 23:30 ` [PATCH v3 01/20] diff: use hashmap_entry_init on moved_entry.ent Eric Wong
2019-10-06 23:30 ` [PATCH v3 02/20] coccicheck: detect hashmap_entry.hash assignment Eric Wong
2019-10-06 23:30 ` [PATCH v3 03/20] packfile: use hashmap_entry in delta_base_cache_entry Eric Wong
2019-10-06 23:30 ` [PATCH v3 04/20] hashmap_entry_init takes "struct hashmap_entry *" Eric Wong
2019-10-06 23:30 ` [PATCH v3 05/20] hashmap_get_next takes "const struct " Eric Wong
2019-10-06 23:30 ` [PATCH v3 06/20] hashmap_add takes "struct " Eric Wong
2019-10-06 23:30 ` [PATCH v3 07/20] hashmap_get takes "const struct " Eric Wong
2019-10-06 23:30 ` [PATCH v3 08/20] hashmap_remove " Eric Wong
2019-10-06 23:30 ` [PATCH v3 09/20] hashmap_put takes "struct " Eric Wong
2019-10-06 23:30 ` [PATCH v3 10/20] introduce container_of macro Eric Wong
2019-10-06 23:30 ` [PATCH v3 11/20] hashmap_get_next returns "struct hashmap_entry *" Eric Wong
2019-10-06 23:30 ` [PATCH v3 12/20] hashmap: use *_entry APIs to wrap container_of Eric Wong
2019-10-06 23:30 ` [PATCH v3 13/20] hashmap_get{,_from_hash} return "struct hashmap_entry *" Eric Wong
2019-10-06 23:30 ` [PATCH v3 14/20] hashmap_cmp_fn takes hashmap_entry params Eric Wong
2019-10-06 23:30 ` [PATCH v3 15/20] hashmap: use *_entry APIs for iteration Eric Wong
2019-10-06 23:30 ` [PATCH v3 16/20] hashmap: hashmap_{put,remove} return hashmap_entry * Eric Wong
2019-10-06 23:30 ` [PATCH v3 17/20] hashmap: introduce hashmap_free_entries Eric Wong
2019-10-06 23:30 ` [PATCH v3 18/20] OFFSETOF_VAR macro to simplify hashmap iterators Eric Wong
2019-10-06 23:30 ` [PATCH v3 19/20] hashmap: remove type arg from hashmap_{get,put,remove}_entry Eric Wong
2019-10-06 23:30 ` [PATCH v3 20/20] hashmap_entry: remove first member requirement from docs Eric Wong
2019-10-07 1:52 ` Junio C Hamano
2019-10-07 8:43 ` [PATCH v3 21/20] convert: drop invalid comment for subprocess_entry Eric Wong
2019-10-08 2:15 ` Junio C Hamano
2019-10-08 2:56 ` Eric Wong [this message]
2019-10-07 1:24 ` [PATCH v3 00/20] hashmap bug/safety/ease-of-use fixes Junio C Hamano
2019-10-08 8:58 ` Johannes Schindelin
2019-10-08 13:56 ` Derrick Stolee
2019-10-08 13:59 ` Derrick Stolee
2019-10-09 1:20 ` 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=20191008025641.zinxoqsrncgzyjcq@dcvr \
--to=e@80x24.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood123@gmail.com \
--cc=stolee@gmail.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).