From c02d5ef7f97f3514a09015504b3fd1253395671f Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 5 Dec 2024 23:29:23 +0000 Subject: [PATCH] Auto-generate files after cl/703267593 --- php/ext/google/protobuf/php-upb.h | 10 ++++++++++ ruby/ext/google/protobuf_c/ruby-upb.h | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index a37e667e2f78..10474556d604 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -1208,6 +1208,16 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { return (a.size == b.size) && (!a.size || !memcmp(a.data, b.data, a.size)); } +// Compares StringViews following strcmp rules. +// Please note this comparison is neither unicode nor locale aware. +UPB_INLINE int upb_StringView_Compare(upb_StringView a, upb_StringView b) { + int result = memcmp(a.data, b.data, UPB_MIN(a.size, b.size)); + if (result == 0) { + return a.size - b.size; + } + return result; +} + // LINT.ThenChange( // GoogleInternalName1, // //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string, diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index 33d0a07eb221..ea668e070b04 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -1210,6 +1210,16 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { return (a.size == b.size) && (!a.size || !memcmp(a.data, b.data, a.size)); } +// Compares StringViews following strcmp rules. +// Please note this comparison is neither unicode nor locale aware. +UPB_INLINE int upb_StringView_Compare(upb_StringView a, upb_StringView b) { + int result = memcmp(a.data, b.data, UPB_MIN(a.size, b.size)); + if (result == 0) { + return a.size - b.size; + } + return result; +} + // LINT.ThenChange( // GoogleInternalName1, // //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string,