From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 02/14] oidtree: extend iteration to allow for arbitrary return codes
Date: Thu, 19 Mar 2026 09:27:29 -0700 [thread overview]
Message-ID: <xmqqa4w3n5se.fsf@gitster.g> (raw)
In-Reply-To: <20260319-b4-pks-odb-source-abbrev-v1-2-5ddebad292b0@pks.im> (Patrick Steinhardt's message of "Thu, 19 Mar 2026 07:53:00 +0100")
Patrick Steinhardt <ps@pks.im> writes:
> diff --git a/cbtree.h b/cbtree.h
> index 43193abdda..4f644d6e45 100644
> --- a/cbtree.h
> +++ b/cbtree.h
> @@ -30,11 +30,6 @@ struct cb_tree {
> struct cb_node *root;
> };
>
> -enum cb_next {
> - CB_CONTINUE = 0,
> - CB_BREAK = 1
> -};
> -
> #define CBTREE_INIT { 0 }
>
> static inline void cb_init(struct cb_tree *t)
> @@ -46,9 +41,9 @@ static inline void cb_init(struct cb_tree *t)
> struct cb_node *cb_lookup(struct cb_tree *, const uint8_t *k, size_t klen);
> struct cb_node *cb_insert(struct cb_tree *, struct cb_node *, size_t klen);
>
This change does make sense,...
> -typedef enum cb_next (*cb_iter)(struct cb_node *, void *arg);
> +typedef int (*cb_iter)(struct cb_node *, void *arg);
... but it probably now warrants a bit of comment as readers cannot
guess from the values in cb_next enum that is gone.
cb_each() keeps iterating while this function returns 0; a non-zero
value returned from the iterator callback is relayed back to the
caller of cb_each() after immediately stopping iteration.
> -void cb_each(struct cb_tree *, const uint8_t *kpfx, size_t klen,
> - cb_iter, void *arg);
> +int cb_each(struct cb_tree *, const uint8_t *kpfx, size_t klen,
> + cb_iter, void *arg);
or something like that, perhaps.
next prev parent reply other threads:[~2026-03-19 16:27 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 6:52 [PATCH 00/14] odb: generic object name handling Patrick Steinhardt
2026-03-19 6:52 ` [PATCH 01/14] oidtree: modernize the code a bit Patrick Steinhardt
2026-03-19 16:08 ` Junio C Hamano
2026-03-20 6:40 ` Patrick Steinhardt
2026-03-20 22:30 ` brian m. carlson
2026-03-23 6:22 ` Patrick Steinhardt
2026-03-19 6:53 ` [PATCH 02/14] oidtree: extend iteration to allow for arbitrary return codes Patrick Steinhardt
2026-03-19 16:27 ` Junio C Hamano [this message]
2026-03-20 6:40 ` Patrick Steinhardt
2026-03-19 16:27 ` Karthik Nayak
2026-03-19 6:53 ` [PATCH 03/14] odb: introduce `struct odb_for_each_object_options` Patrick Steinhardt
2026-03-19 14:25 ` Junio C Hamano
2026-03-19 14:59 ` Patrick Steinhardt
2026-03-20 9:01 ` Karthik Nayak
2026-03-19 6:53 ` [PATCH 04/14] object-name: move logic to iterate through loose prefixed objects Patrick Steinhardt
2026-03-19 6:53 ` [PATCH 05/14] object-name: move logic to iterate through packed " Patrick Steinhardt
2026-03-19 6:53 ` [PATCH 06/14] object-name: extract function to parse object ID prefixes Patrick Steinhardt
2026-03-19 6:53 ` [PATCH 07/14] object-name: backend-generic `repo_collect_ambiguous()` Patrick Steinhardt
2026-03-19 14:26 ` Junio C Hamano
2026-03-19 14:59 ` Patrick Steinhardt
2026-03-20 9:23 ` Karthik Nayak
2026-03-19 6:53 ` [PATCH 08/14] object-name: backend-generic `get_short_oid()` Patrick Steinhardt
2026-03-19 6:53 ` [PATCH 09/14] object-name: merge `update_candidates()` and `match_prefix()` Patrick Steinhardt
2026-03-19 6:53 ` [PATCH 10/14] object-name: abbreviate loose object names without `disambiguate_state` Patrick Steinhardt
2026-03-19 6:53 ` [PATCH 11/14] object-name: simplify computing common prefixes Patrick Steinhardt
2026-03-20 10:01 ` Karthik Nayak
2026-03-20 10:30 ` Patrick Steinhardt
2026-03-19 6:53 ` [PATCH 12/14] object-name: move logic to compute loose abbreviation length Patrick Steinhardt
2026-03-19 6:53 ` [PATCH 13/14] object-file: move logic to compute packed " Patrick Steinhardt
2026-03-19 6:53 ` [PATCH 14/14] odb: introduce generic `odb_find_abbrev_len()` Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 00/14] odb: generic object name handling Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 01/14] oidtree: modernize the code a bit Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 02/14] oidtree: extend iteration to allow for arbitrary return codes Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 03/14] odb: introduce `struct odb_for_each_object_options` Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 04/14] object-name: move logic to iterate through loose prefixed objects Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 05/14] object-name: move logic to iterate through packed " Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 06/14] object-name: extract function to parse object ID prefixes Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 07/14] object-name: backend-generic `repo_collect_ambiguous()` Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 08/14] object-name: backend-generic `get_short_oid()` Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 09/14] object-name: merge `update_candidates()` and `match_prefix()` Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 10/14] object-name: abbreviate loose object names without `disambiguate_state` Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 11/14] object-name: simplify computing common prefixes Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 12/14] object-name: move logic to compute loose abbreviation length Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 13/14] object-file: move logic to compute packed " Patrick Steinhardt
2026-03-20 7:07 ` [PATCH v2 14/14] odb: introduce generic `odb_find_abbrev_len()` Patrick Steinhardt
2026-03-20 10:04 ` [PATCH v2 00/14] odb: generic object name handling Karthik Nayak
2026-03-20 10:30 ` Patrick Steinhardt
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=xmqqa4w3n5se.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox