hpb: when parsing T*'s, delegate to the canonical Ptr<T>
PiperOrigin-RevId: 698458386
diff --git a/hpb/hpb.h b/hpb/hpb.h
index 3becc50..5591f67 100644
--- a/hpb/hpb.h
+++ b/hpb/hpb.h
@@ -96,6 +96,11 @@
}
template <typename T>
+ABSL_MUST_USE_RESULT bool Parse(T* message, absl::string_view bytes) {
+ return Parse(Ptr(message), bytes);
+}
+
+template <typename T>
absl::StatusOr<T> Parse(absl::string_view bytes, int options = 0) {
T message;
auto* arena = hpb::interop::upb::GetArena(&message);
@@ -110,19 +115,6 @@
}
template <typename T>
-ABSL_MUST_USE_RESULT bool Parse(T* message, absl::string_view bytes) {
- static_assert(!std::is_const_v<T>);
- upb_Message_Clear(hpb::interop::upb::GetMessage(message),
- ::hpb::interop::upb::GetMiniTable(message));
- auto* arena = hpb::interop::upb::GetArena(message);
- return upb_Decode(bytes.data(), bytes.size(),
- hpb::interop::upb::GetMessage(message),
- ::hpb::interop::upb::GetMiniTable(message),
- /* extreg= */ nullptr, /* options= */ 0,
- arena) == kUpb_DecodeStatus_Ok;
-}
-
-template <typename T>
absl::StatusOr<T> Parse(absl::string_view bytes,
const ::hpb::ExtensionRegistry& extension_registry,
int options = 0) {