Auto-generate files after cl/646470242
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 8f34580..71d7464 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c
@@ -5866,6 +5866,36 @@ return clone; } +#include "stddef.h" + +// Must be last. + +bool upb_Message_MergeFrom(upb_Message* dst, const upb_Message* src, + const upb_MiniTable* mt, + const upb_ExtensionRegistry* extreg, + upb_Arena* arena) { + char* buf = NULL; + size_t size = 0; + // This tmp arena is used to hold the bytes for `src` serialized. This bends + // the typical "no hidden allocations" design of upb, but under a properly + // optimized implementation this extra allocation would not be necessary and + // so we don't want to unnecessarily have the bad API or bloat the passed-in + // arena with this very-short-term allocation. + upb_Arena* encode_arena = upb_Arena_New(); + upb_EncodeStatus e_status = upb_Encode(src, mt, 0, encode_arena, &buf, &size); + if (e_status != kUpb_EncodeStatus_Ok) { + upb_Arena_Free(encode_arena); + return false; + } + upb_DecodeStatus d_status = upb_Decode(buf, size, dst, mt, extreg, 0, arena); + if (d_status != kUpb_DecodeStatus_Ok) { + upb_Arena_Free(encode_arena); + return false; + } + upb_Arena_Free(encode_arena); + return true; +} + #include <stddef.h> #include <stdint.h>
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index 73164b4..f749d24 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h
@@ -13596,6 +13596,26 @@ #endif // UPB_MESSAGE_COPY_H_ +#ifndef THIRD_PARTY_UPB_UPB_MESSAGE_MERGE_H_ +#define THIRD_PARTY_UPB_UPB_MESSAGE_MERGE_H_ + + +// Must be last. + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_API bool upb_Message_MergeFrom(upb_Message* dst, const upb_Message* src, + const upb_MiniTable* mt, + const upb_ExtensionRegistry* extreg, + upb_Arena* arena); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // THIRD_PARTY_UPB_UPB_MESSAGE_MERGE_H_ #ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_ #define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_