diff --git a/hpb/internal.h b/hpb/internal.h index b83236691c..5ff49cb5eb 100644 --- a/hpb/internal.h +++ b/hpb/internal.h @@ -11,7 +11,7 @@ #include "upb/mem/arena.h" #include "upb/message/message.h" -namespace protos::internal { +namespace hpb::internal { // Moves ownership of a message created in a source arena. // @@ -21,5 +21,5 @@ T MoveMessage(upb_Message* msg, upb_Arena* arena) { return T(msg, arena); } -} // namespace protos::internal +} // namespace hpb::internal #endif diff --git a/hpb/internal_test.cc b/hpb/internal_test.cc index 7ee2270759..fbfdd0be25 100644 --- a/hpb/internal_test.cc +++ b/hpb/internal_test.cc @@ -25,8 +25,8 @@ TEST(CppGeneratedCode, InternalMoveMessage) { hpb_unittest_TestModel_set_int_value_with_default(message, 123); // Move ownership. - TestModel model = protos::internal::MoveMessage( - (upb_Message*)message, source_arena); + TestModel model = hpb::internal::MoveMessage((upb_Message*)message, + source_arena); // Now that we have moved ownership, free original arena. upb_Arena_Free(source_arena); EXPECT_EQ(model.int_value_with_default(), 123); diff --git a/hpb_generator/gen_messages.cc b/hpb_generator/gen_messages.cc index ff0c1940e0..75e486ed24 100644 --- a/hpb_generator/gen_messages.cc +++ b/hpb_generator/gen_messages.cc @@ -254,8 +254,7 @@ void WriteModelPublicDeclaration( int options)); friend upb_Arena* ::protos::internal::GetArena<$0>($0* message); friend upb_Arena* ::protos::internal::GetArena<$0>(::protos::Ptr<$0> message); - friend $0(::protos::internal::MoveMessage<$0>(upb_Message* msg, - upb_Arena* arena)); + friend $0(::hpb::internal::MoveMessage<$0>(upb_Message* msg, upb_Arena* arena)); )cc", ClassName(descriptor), MessageName(descriptor), QualifiedClassName(descriptor)); diff --git a/protos/protos_internal.h b/protos/protos_internal.h index 0370af3cb0..cbfac75f09 100644 --- a/protos/protos_internal.h +++ b/protos/protos_internal.h @@ -8,4 +8,7 @@ #ifndef UPB_PROTOS_PROTOS_INTERNAL_H_ #define UPB_PROTOS_PROTOS_INTERNAL_H_ #include "google/protobuf/hpb/internal.h" +namespace protos::internal { +using ::hpb::internal::MoveMessage; +} // namespace protos::internal #endif