move extension_registry declarations out of msg_internal.h

PiperOrigin-RevId: 478407599
pull/13171/head
Eric Salo 2 years ago committed by Copybara-Service
parent e79e3dbfd7
commit 787714f60d
  1. 23
      upb/extension_registry.h
  2. 21
      upb/msg_internal.h

@ -71,13 +71,30 @@ extern "C" {
* reflection do not need to populate a upb_ExtensionRegistry directly.
*/
struct upb_ExtensionRegistry;
typedef struct upb_ExtensionRegistry upb_ExtensionRegistry;
/* Creates a upb_ExtensionRegistry in the given arena. The arena must outlive
* any use of the extreg. */
// Creates a upb_ExtensionRegistry in the given arena.
// The arena must outlive any use of the extreg.
upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena);
// EVERYTHING BELOW THIS LINE IS INTERNAL - DO NOT USE /////////////////////////
typedef struct upb_MiniTable upb_MiniTable;
typedef struct upb_MiniTable_Extension upb_MiniTable_Extension;
// Adds the given extension info for message type |l| and field number |num|
// into the registry. Returns false if this message type and field number were
// already in the map, or if memory allocation fails.
bool _upb_extreg_add(upb_ExtensionRegistry* r,
const upb_MiniTable_Extension** e, size_t count);
// Looks up the extension (if any) defined for message type |l| and field
// number |num|. If an extension was found, copies the field info into |*ext|
// and returns true. Otherwise returns false.
const upb_MiniTable_Extension* _upb_extreg_get(const upb_ExtensionRegistry* r,
const upb_MiniTable* l,
uint32_t num);
#ifdef __cplusplus
} /* extern "C" */
#endif

@ -226,11 +226,13 @@ struct upb_MiniTable {
_upb_FastTable_Entry fasttable[];
};
typedef struct {
typedef struct upb_MiniTable_Extension upb_MiniTable_Extension;
struct upb_MiniTable_Extension {
upb_MiniTable_Field field;
const upb_MiniTable* extendee;
upb_MiniTable_Sub sub; /* NULL unless submessage or proto2 enum */
} upb_MiniTable_Extension;
};
typedef struct {
const upb_MiniTable** msgs;
@ -253,21 +255,6 @@ UPB_INLINE uint64_t upb_MiniTable_requiredmask(const upb_MiniTable* l) {
return ((1ULL << n) - 1) << 1;
}
/** upb_ExtensionRegistry *****************************************************/
/* Adds the given extension info for message type |l| and field number |num|
* into the registry. Returns false if this message type and field number were
* already in the map, or if memory allocation fails. */
bool _upb_extreg_add(upb_ExtensionRegistry* r,
const upb_MiniTable_Extension** e, size_t count);
/* Looks up the extension (if any) defined for message type |l| and field
* number |num|. If an extension was found, copies the field info into |*ext|
* and returns true. Otherwise returns false. */
const upb_MiniTable_Extension* _upb_extreg_get(const upb_ExtensionRegistry* r,
const upb_MiniTable* l,
uint32_t num);
/** upb_Message ***************************************************************/
/* Internal members of a upb_Message that track unknown fields and/or

Loading…
Cancel
Save