- opt_default is now kUpbDefOptDefault
- upb_AddDefCtx is now upb_DefBuilder
- shortdefname() is now _upb_DefBuilder_FullToShort()
- pack_def() is now _upb_DefBuilder_Pack()
- unpack_def() is now _upb_DefBuilder_Unpack()
- UPB_ASSERT() checks on def struct size moved up in the call chain
- remove/expand CHK_OOM
PiperOrigin-RevId: 471862679
(Because it is a better name and we can't properly bikeshed it without changing
it a few times first.)
Also removed it as an arg from a function that doesn't actually need it.
PiperOrigin-RevId: 470978322
- check_ident() is now _upb_AddDefCtx_CheckIdent()
- makefullname() is now _upb_AddDefCtx_MakeFullName()
- symtab_add() is now _upb_AddDefCtx_Add()
- symtab_alloc() is now _upb_AddDefCtx_Alloc()
- symtab_errf() is now _upb_AddDefCtx_Errf()
- symtab_oomerr() is now _upb_AddDefCtx_OomErr()
PiperOrigin-RevId: 470806376
- renamed symtab_addctx as upb_AddDefCtx
- simplified _upb_DefPool_AddFile() slightly
- replaced upb_Status_setoom() with kOutOfMemory
- deleted all references to UPB_DEFTYPE_LAYOUT and UPB_DEFTYPE_FILE
PiperOrigin-RevId: 470592649
This function was introduced in https://github.com/protocolbuffers/upb/pull/426 but it appears it was never used. I am not sure what the purpose was, but in any case it is not needed.
With this function removed, we no longer need to tag pointers for the DefPool "files" table.
PiperOrigin-RevId: 470567000
There are many places within def.c where a function which implements a method
for struct A ends up directly accessing fields within struct B even though
accessor functions for these fields are defined. So, this is a first pass at
trying to clean that up a bit. Yes, we are adding function calls to a lot of
code paths by doing this but in the unlikely event that this adds unacceptable
overhead we can deal with it then.
PiperOrigin-RevId: 470321129
Give the def types their own array allocators and also implement some simple array constructors for the enum and enum value defs.
PiperOrigin-RevId: 470042521
delete upb_EnumDef_IsSorted()
We now have a simple internal function for returning a mini descriptor directly from an enum def.
PiperOrigin-RevId: 461208352
1. upb now tolerates a present-but-empty package name in a `FileDescriptorProto`.
2. upb now always returns a non-NULL string for `upb_FileDef_Package()`. If the package was empty or missing, the returned string is zero-length. This better matches the proto2 behavior: `proto2::FileDescriptor::package()` always returns a package string, which may be empty.
PiperOrigin-RevId: 460831797
An enum MiniDescriptor simply encodes a set of valid `int32_t` values, so that the protobuf parser can test whether a given enum value is known or not.
The format implemented here is novel and needs to be documented. In short, the format is:
1. base92 values 0-31: 5-bit mask indicating presence or absence of the next five enum values.
2. base92 values 60-91: varint indicating skip over a region of enum values.
Negative enum values are encoded as their `uint32_t` equivalent.
PiperOrigin-RevId: 442892799