aboutsummaryrefslogtreecommitdiff
path: root/cbtree.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-04-06 15:42:48 -0700
committerJunio C Hamano <gitster@pobox.com>2026-04-06 15:42:49 -0700
commitd75badf83bc3fc8e47413970874bac681eeb5bbe (patch)
tree081e6d6ef91541664ae664acc0af7f8e7f943d01 /cbtree.h
parent2f8c3f6a5a6d6a3de205be709e1a598b9d4b0b3e (diff)
parent83869e15fa9ef3b0ea2adbfe2fe68a309f95b856 (diff)
downloadgit-d75badf83bc3fc8e47413970874bac681eeb5bbe.tar.xz
Merge branch 'ps/odb-generic-object-name-handling'
Object name handling (disambiguation and abbreviation) has been refactored to be backend-generic, moving logic into the respective object database backends. * ps/odb-generic-object-name-handling: odb: introduce generic `odb_find_abbrev_len()` object-file: move logic to compute packed abbreviation length object-name: move logic to compute loose abbreviation length object-name: simplify computing common prefixes object-name: abbreviate loose object names without `disambiguate_state` object-name: merge `update_candidates()` and `match_prefix()` object-name: backend-generic `get_short_oid()` object-name: backend-generic `repo_collect_ambiguous()` object-name: extract function to parse object ID prefixes object-name: move logic to iterate through packed prefixed objects object-name: move logic to iterate through loose prefixed objects odb: introduce `struct odb_for_each_object_options` oidtree: extend iteration to allow for arbitrary return codes oidtree: modernize the code a bit object-file: fix sparse 'plain integer as NULL pointer' error
Diffstat (limited to 'cbtree.h')
-rw-r--r--cbtree.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/cbtree.h b/cbtree.h
index 43193abdda..c374b1b3db 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,15 @@ 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);
-typedef enum cb_next (*cb_iter)(struct cb_node *, void *arg);
+/*
+ * Callback invoked by `cb_each()` for each node in the critbit tree. A return
+ * value of 0 will cause the iteration to continue, a non-zero return code will
+ * cause iteration to abort. The error code will be relayed back from
+ * `cb_each()` in that case.
+ */
+typedef int (*cb_iter)(struct cb_node *, void *arg);
-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);
#endif /* CBTREE_H */