Skip to content

Commit

Permalink
upb: Add upb_Message_GetExtensionMutableArray
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 698010022
  • Loading branch information
honglooker authored and copybara-github committed Nov 19, 2024
1 parent 8aa3d35 commit cd837fd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
17 changes: 0 additions & 17 deletions csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs

This file was deleted.

3 changes: 3 additions & 0 deletions upb/message/accessors.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ UPB_API_INLINE upb_Message* upb_Message_GetExtensionMessage(
UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray(
const upb_Message* msg, const upb_MiniTableExtension* f);

UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray(
upb_Message* msg, const upb_MiniTableExtension* f);

// Extension Setters ///////////////////////////////////////////////////////////

UPB_API_INLINE bool upb_Message_SetExtension(upb_Message* msg,
Expand Down
13 changes: 13 additions & 0 deletions upb/message/internal/accessors.h
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,19 @@ UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray(
return ret;
}

UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray(
struct upb_Message* msg, const upb_MiniTableExtension* e) {
UPB_ASSERT(!upb_Message_IsFrozen(msg));
UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)) ==
kUpb_FieldRep_NativePointer);
UPB_ASSUME(upb_MiniTableField_IsArray(&e->UPB_PRIVATE(field)));
UPB_ASSUME(e->UPB_PRIVATE(field).presence == 0);
upb_Array* ret;
upb_Array* default_val = NULL;
_upb_Message_GetExtensionField(msg, e, &default_val, &ret);
return ret;
}

#ifdef __cplusplus
} /* extern "C" */
#endif
Expand Down

0 comments on commit cd837fd

Please sign in to comment.