Commit c59b146a authored by Robert Edmonds's avatar Robert Edmonds

compat: Use absl::string_view instead of google::protobuf::internal::DescriptorStringView

Even though google::protobuf::internal::DescriptorStringView is exposed
in public protobuf headers, it's probably not a good idea to rely on an
"internal" typedef.

According to https://protobuf.dev/news/2024-10-02/#descriptor-apis:

    v30 will update return types in descriptor (such as full_name) to be
    absl::string_view.

So `absl::string_view` is probably the right type to use here.
parent ebeddac1
...@@ -37,12 +37,16 @@ ...@@ -37,12 +37,16 @@
# define GOOGLE_LOG ABSL_LOG # define GOOGLE_LOG ABSL_LOG
#endif #endif
#if GOOGLE_PROTOBUF_VERSION >= 6030000
# include <absl/strings/string_view.h>
#endif
namespace protobuf_c { namespace protobuf_c {
namespace compat { namespace compat {
#if GOOGLE_PROTOBUF_VERSION >= 6030000 #if GOOGLE_PROTOBUF_VERSION >= 6030000
typedef google::protobuf::internal::DescriptorStringView StringView; typedef absl::string_view StringView;
#else #else
typedef const std::string& StringView; typedef const std::string& StringView;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment