Skip to content

Commit

Permalink
Change the arena.hpp ::Fuse return type to bool to surface whether th…
Browse files Browse the repository at this point in the history
…e fuse failed.

PiperOrigin-RevId: 628161481
  • Loading branch information
protobuf-github-bot authored and Copybara-Service committed Apr 25, 2024
1 parent 419824d commit 62f2b14
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion upb/mem/arena.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ class Arena {

upb_Arena* ptr() const { return ptr_.get(); }

void Fuse(Arena& other) { upb_Arena_Fuse(ptr(), other.ptr()); }
// Fuses the arenas together.
// This operation can only be performed on arenas with no initial blocks. Will
// return false if the fuse failed due to either arena having an initial
// block.
bool Fuse(Arena& other) { return upb_Arena_Fuse(ptr(), other.ptr()); }

protected:
std::unique_ptr<upb_Arena, decltype(&upb_Arena_Free)> ptr_;
Expand Down

0 comments on commit 62f2b14

Please sign in to comment.