]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
cpp-btree: fix array bounds warning in btree_node::swap() 65450/head
authorKefu Chai <tchaikov@gmail.com>
Tue, 9 Sep 2025 10:10:18 +0000 (18:10 +0800)
committerKefu Chai <tchaikov@gmail.com>
Wed, 10 Sep 2025 08:07:44 +0000 (16:07 +0800)
commit8458a19abf810e41ad8e4616dca2e50de353594e
tree57dd46b54482ea3a2b21f3d877025444a6d49a85
parentac1af204fb0774561a7bd7d3deb1e6c2279d8e74
cpp-btree: fix array bounds warning in btree_node::swap()

Replace direct array indexing with pointer arithmetic to avoid
compiler warning when forming ranges for std::swap_ranges().

The original code was functionally correct but triggered
-Werror=array-bounds when accessing mutable_child(count + 1)
to create the end iterator. Using pointer arithmetic achieves
the same result without the bounds check warning.

No functional changes.

Fixes: https://tracker.ceph.com/issues/72477
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/include/cpp-btree/btree.h