]> Kevux Git Server - rit/commit
oidtree: modernize the code a bit
authorPatrick Steinhardt <ps@pks.im>
Fri, 20 Mar 2026 07:07:27 +0000 (08:07 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Mar 2026 20:16:22 +0000 (13:16 -0700)
commit1382e54a9c9e5f98271a943af9c10299c6ba934b
tree9dfbf3c312c9adbfd83f1be687fdcacd82cc7dd7
parent7f757675549755627d0c778296f0b13f331795be
oidtree: modernize the code a bit

The "oidtree.c" subsystem is rather small and self-contained and tends
to just work. It thus doesn't typically receive a lot of attention,
which has as a consequence that it's coding style is somewhat dated
nowadays.

Modernize the style of this subsystem a bit:

  - Rename the `oidtree_iter()` function to `oidtree_each_cb()`.

  - Rename `struct oidtree_iter_data` to `struct oidtree_each_data` to
    match the renamed callback function type.

  - Rename parameters and variables to clarify their intent.

  - Add comments that explain what some of the functions do.

  - Adapt the return value of `oidtree_contains()` to be a boolean.

This prepares for some changes to the subsystem that'll happen in the
next commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
oidtree.c
oidtree.h
t/unit-tests/u-oidtree.c