Auto-generate files after cl/590420044
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 965e40a..af198bf 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c
@@ -5442,6 +5442,25 @@ } +#include <stddef.h> +#include <stdint.h> + + +// Must be last. + +const upb_Message_Extension* upb_Message_FindExtensionByNumber( + const upb_Message* msg, uint32_t field_number) { + size_t count = 0; + const upb_Message_Extension* ext = _upb_Message_Getexts(msg, &count); + + while (count--) { + if (upb_MiniTableExtension_Number(ext->ext) == field_number) return ext; + ext++; + } + return NULL; +} + + #include <string.h>
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index aa54ab7..d7540da 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h
@@ -1627,6 +1627,8 @@ // Must be last. +typedef struct upb_Message_Extension upb_Message_Extension; + #ifdef __cplusplus extern "C" { #endif @@ -1749,14 +1751,14 @@ // This is rather wasteful for scalars (in the extreme case of bool, // it wastes 15 bytes). We accept this because we expect messages to be // the most common extension type. -typedef struct { +struct upb_Message_Extension { const upb_MiniTableExtension* ext; union { upb_StringView str; void* ptr; char scalar_data[8]; } data; -} upb_Message_Extension; +}; #ifdef __cplusplus extern "C" { @@ -12155,6 +12157,34 @@ #endif // UPB_PORT_ATOMIC_H_ +#ifndef UPB_MESSAGE_COMPAT_H_ +#define UPB_MESSAGE_COMPAT_H_ + +#include <stdint.h> + + +// Must be last. + +// upb does not support mixing minitables from different sources but these +// functions are still used by some existing users so for now we make them +// available here. This may or may not change in the future so do not add +// them to new code. + +#ifdef __cplusplus +extern "C" { +#endif + +// Returns the extension with the given field number, or NULL on failure. +const upb_Message_Extension* upb_Message_FindExtensionByNumber( + const upb_Message* msg, uint32_t field_number); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MESSAGE_COMPAT_H_ */ + #ifndef UPB_MESSAGE_COPY_H_ #define UPB_MESSAGE_COPY_H_