On Thu, Mar 19, 2026 at 09:27:29AM -0700, Junio C Hamano wrote:
Show 41 quoted lines
> 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.