From 62f2b143d529c3d899bda4c91fce12da0fdeabd7 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 25 Apr 2024 12:46:17 -0700 Subject: [PATCH] Change the arena.hpp ::Fuse return type to bool to surface whether the fuse failed. PiperOrigin-RevId: 628161481 --- upb/mem/arena.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/upb/mem/arena.hpp b/upb/mem/arena.hpp index e552ceb167..420adfa463 100644 --- a/upb/mem/arena.hpp +++ b/upb/mem/arena.hpp @@ -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 ptr_;