From 6cbcff4bb6fb11e32d61a1fe819a546ece03c16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Wed, 6 Mar 2024 10:12:51 -0800 Subject: [PATCH] Clarify that `upb_Message_SetString` does not copy data. PiperOrigin-RevId: 613258771 --- upb/message/accessors.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/upb/message/accessors.h b/upb/message/accessors.h index af9da84422..f091140aa3 100644 --- a/upb/message/accessors.h +++ b/upb/message/accessors.h @@ -295,6 +295,10 @@ upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field, return upb_Message_GetField(msg, field, def).str_val; } +// Sets the value of a `string` or `bytes` field. The bytes of the value are not +// copied, so it is the caller's responsibility to ensure that they remain valid +// for the lifetime of `msg`. That might be done by copying them into the given +// arena, or by fusing that arena with the arena the bytes live in, for example. UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg, const upb_MiniTableField* field, upb_StringView value, upb_Arena* a) {