From 06327f0a7c9165a6099c7fd66c89021211de6c77 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 11 Jan 2024 17:35:29 +0000 Subject: [PATCH] Auto-generate files after cl/597573362 --- php/ext/google/protobuf/php-upb.c | 9 +++++++++ php/ext/google/protobuf/php-upb.h | 4 ++++ ruby/ext/google/protobuf_c/ruby-upb.c | 9 +++++++++ ruby/ext/google/protobuf_c/ruby-upb.h | 4 ++++ 4 files changed, 26 insertions(+) diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index 66858595782bf..67493f013fa80 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -5084,6 +5084,15 @@ upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i) { return ret; } +upb_MutableMessageValue upb_Array_GetMutable(upb_Array* arr, size_t i) { + upb_MutableMessageValue ret; + char* data = _upb_array_ptr(arr); + const int lg2 = UPB_PRIVATE(_upb_Array_ElemSizeLg2)(arr); + UPB_ASSERT(i < arr->UPB_PRIVATE(size)); + memcpy(&ret, data + (i << lg2), 1 << lg2); + return ret; +} + void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val) { char* data = _upb_array_ptr(arr); const int lg2 = UPB_PRIVATE(_upb_Array_ElemSizeLg2)(arr); diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index a97197ba9cab7..5a0c05452781b 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -870,6 +870,10 @@ UPB_API size_t upb_Array_Size(const upb_Array* arr); // Returns the given element, which must be within the array's current size. UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i); +// Returns a mutating pointer to the given element, which must be within the +// array's current size. +UPB_API upb_MutableMessageValue upb_Array_GetMutable(upb_Array* arr, size_t i); + // Sets the given element, which must be within the array's current size. UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val); diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 4e9b711b3f7f0..8d19b4a15d343 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -4599,6 +4599,15 @@ upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i) { return ret; } +upb_MutableMessageValue upb_Array_GetMutable(upb_Array* arr, size_t i) { + upb_MutableMessageValue ret; + char* data = _upb_array_ptr(arr); + const int lg2 = UPB_PRIVATE(_upb_Array_ElemSizeLg2)(arr); + UPB_ASSERT(i < arr->UPB_PRIVATE(size)); + memcpy(&ret, data + (i << lg2), 1 << lg2); + return ret; +} + void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val) { char* data = _upb_array_ptr(arr); const int lg2 = UPB_PRIVATE(_upb_Array_ElemSizeLg2)(arr); diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index 4598f3b56b358..3f895c38bbea9 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -872,6 +872,10 @@ UPB_API size_t upb_Array_Size(const upb_Array* arr); // Returns the given element, which must be within the array's current size. UPB_API upb_MessageValue upb_Array_Get(const upb_Array* arr, size_t i); +// Returns a mutating pointer to the given element, which must be within the +// array's current size. +UPB_API upb_MutableMessageValue upb_Array_GetMutable(upb_Array* arr, size_t i); + // Sets the given element, which must be within the array's current size. UPB_API void upb_Array_Set(upb_Array* arr, size_t i, upb_MessageValue val);