|
|
|
@ -1936,6 +1936,57 @@ upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size); |
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
|
|
|
|
#define UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
|
|
|
|
#define UPB_MINI_TABLE_INTERNAL_TYPES_H_ |
|
|
|
|
|
|
|
|
|
typedef struct upb_Message_InternalData upb_Message_InternalData; |
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
union { |
|
|
|
|
upb_Message_InternalData* internal; |
|
|
|
|
|
|
|
|
|
// Force 8-byte alignment, since the data members may contain members that
|
|
|
|
|
// require 8-byte alignment.
|
|
|
|
|
double d; |
|
|
|
|
}; |
|
|
|
|
} upb_Message_Internal; |
|
|
|
|
|
|
|
|
|
#endif // UPB_MINI_TABLE_INTERNAL_TYPES_H_
|
|
|
|
|
|
|
|
|
|
// Map entries aren't actually stored for map fields, they are only used during
|
|
|
|
|
// parsing. For parsing, it helps a lot if all map entry messages have the same
|
|
|
|
|
// layout. The layout code in mini_table/decode.c will ensure that all map
|
|
|
|
|
// entries have this layout.
|
|
|
|
|
//
|
|
|
|
|
// Note that users can and do create map entries directly, which will also use
|
|
|
|
|
// this layout.
|
|
|
|
|
//
|
|
|
|
|
// NOTE: sync with wire/decode.c.
|
|
|
|
|
typedef struct { |
|
|
|
|
// We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
|
|
|
|
|
// and the uint64_t helps make this clear.
|
|
|
|
|
uint64_t hasbits; |
|
|
|
|
union { |
|
|
|
|
upb_StringView str; // For str/bytes.
|
|
|
|
|
upb_value val; // For all other types.
|
|
|
|
|
} k; |
|
|
|
|
union { |
|
|
|
|
upb_StringView str; // For str/bytes.
|
|
|
|
|
upb_value val; // For all other types.
|
|
|
|
|
} v; |
|
|
|
|
} upb_MapEntryData; |
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
upb_Message_Internal internal; |
|
|
|
|
upb_MapEntryData data; |
|
|
|
|
} upb_MapEntry; |
|
|
|
|
|
|
|
|
|
#endif // UPB_COLLECTIONS_INTERNAL_MAP_ENTRY_H_
|
|
|
|
|
|
|
|
|
|
#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_ |
|
|
|
|
#define UPB_MESSAGE_INTERNAL_EXTENSION_H_ |
|
|
|
|
|
|
|
|
@ -2053,50 +2104,6 @@ const upb_Message_Extension* _upb_Message_Getext( |
|
|
|
|
|
|
|
|
|
#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */ |
|
|
|
|
|
|
|
|
|
#ifndef UPB_MINI_TABLE_INTERNAL_MAP_ENTRY_DATA_H_ |
|
|
|
|
#define UPB_MINI_TABLE_INTERNAL_MAP_ENTRY_DATA_H_ |
|
|
|
|
|
|
|
|
|
#include <stdint.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Map entries aren't actually stored for map fields, they are only used during
|
|
|
|
|
// parsing. For parsing, it helps a lot if all map entry messages have the same
|
|
|
|
|
// layout. The layout code in mini_table/decode.c will ensure that all map
|
|
|
|
|
// entries have this layout.
|
|
|
|
|
//
|
|
|
|
|
// Note that users can and do create map entries directly, which will also use
|
|
|
|
|
// this layout.
|
|
|
|
|
//
|
|
|
|
|
// NOTE: sync with mini_table/decode.c.
|
|
|
|
|
typedef struct { |
|
|
|
|
// We only need 2 hasbits max, but due to alignment we'll use 8 bytes here,
|
|
|
|
|
// and the uint64_t helps make this clear.
|
|
|
|
|
uint64_t hasbits; |
|
|
|
|
union { |
|
|
|
|
upb_StringView str; // For str/bytes.
|
|
|
|
|
upb_value val; // For all other types.
|
|
|
|
|
} k; |
|
|
|
|
union { |
|
|
|
|
upb_StringView str; // For str/bytes.
|
|
|
|
|
upb_value val; // For all other types.
|
|
|
|
|
} v; |
|
|
|
|
} upb_MapEntryData; |
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
// LINT.IfChange(internal_layout)
|
|
|
|
|
union { |
|
|
|
|
void* internal_data; |
|
|
|
|
|
|
|
|
|
// Force 8-byte alignment, since the data members may contain members that
|
|
|
|
|
// require 8-byte alignment.
|
|
|
|
|
double d; |
|
|
|
|
}; |
|
|
|
|
// LINT.ThenChange(//depot/google3/third_party/upb/upb/message/internal/message.h:internal_layout)
|
|
|
|
|
upb_MapEntryData data; |
|
|
|
|
} upb_MapEntry; |
|
|
|
|
|
|
|
|
|
#endif // UPB_MINI_TABLE_INTERNAL_MAP_ENTRY_DATA_H_
|
|
|
|
|
|
|
|
|
|
// Must be last.
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus |
|
|
|
@ -2399,7 +2406,7 @@ extern const double kUpb_NaN; |
|
|
|
|
* these before the user's data. The user's upb_Message* points after the |
|
|
|
|
* upb_Message_Internal. */ |
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
struct upb_Message_InternalData { |
|
|
|
|
/* Total size of this structure, including the data that follows.
|
|
|
|
|
* Must be aligned to 8, which is alignof(upb_Message_Extension) */ |
|
|
|
|
uint32_t size; |
|
|
|
@ -2421,20 +2428,7 @@ typedef struct { |
|
|
|
|
uint32_t ext_begin; |
|
|
|
|
/* Data follows, as if there were an array:
|
|
|
|
|
* char data[size - sizeof(upb_Message_InternalData)]; */ |
|
|
|
|
} upb_Message_InternalData; |
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
// LINT.IfChange(internal_layout)
|
|
|
|
|
union { |
|
|
|
|
upb_Message_InternalData* internal; |
|
|
|
|
|
|
|
|
|
// Force 8-byte alignment, since the data members may contain members that
|
|
|
|
|
// require 8-byte alignment.
|
|
|
|
|
double d; |
|
|
|
|
}; |
|
|
|
|
// LINT.ThenChange(//depot/google3/third_party/upb/upb/message/internal/map_entry.h:internal_layout)
|
|
|
|
|
/* Message data follows. */ |
|
|
|
|
} upb_Message_Internal; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/* Maps upb_CType -> memory size. */ |
|
|
|
|
extern char _upb_CTypeo_size[12]; |
|
|
|
|