28 .metadata = {.map_metadata = {.allocated = size,
44 .metadata = {.map_metadata = {.allocated = 0,
73 size_t new_allocation = metadata->
allocated == 0
75 : CBOR_BUFFER_GROWTH * metadata->
allocated;
80 if (new_data == NULL) {
84 item->
data = new_data;
_cbor_malloc_t _cbor_malloc
cbor_item_t * cbor_incref(cbor_item_t *item)
Increases the item's reference count by one.
bool cbor_isa_map(const cbor_item_t *item)
Does the item have the appropriate major type?
#define _CBOR_DEPENDENT_NOTNULL(cbor_item, pointer)
#define _CBOR_NOTNULL(cbor_item)
@ _CBOR_METADATA_DEFINITE
@ _CBOR_METADATA_INDEFINITE
bool cbor_map_is_definite(const cbor_item_t *item)
Is this map definite?
struct cbor_pair * cbor_map_handle(const cbor_item_t *item)
Get the pairs storage.
size_t cbor_map_size(const cbor_item_t *item)
Get the number of pairs.
size_t cbor_map_allocated(const cbor_item_t *item)
Get the size of the allocated storage.
bool _cbor_map_add_key(cbor_item_t *item, cbor_item_t *key)
Add a key to the map.
cbor_item_t * cbor_new_indefinite_map(void)
Create a new indefinite map.
bool cbor_map_is_indefinite(const cbor_item_t *item)
Is this map indefinite?
bool _cbor_map_add_value(cbor_item_t *item, cbor_item_t *value)
Add a value to the map.
cbor_item_t * cbor_new_definite_map(size_t size)
Create a new definite map.
bool cbor_map_add(cbor_item_t *item, struct cbor_pair pair)
Add a pair to the map.
void * _cbor_realloc_multiple(void *pointer, size_t item_size, size_t item_count)
Overflow-proof contiguous array reallocation.
void * _cbor_alloc_multiple(size_t item_size, size_t item_count)
Overflow-proof contiguous array allocation.
bool _cbor_safe_to_multiply(size_t a, size_t b)
Can a and b be multiplied without overflowing size_t?
unsigned char * data
Raw data block - interpretation depends on metadata.
union cbor_item_metadata metadata
Discriminated by type.
Simple pair of items for use in maps.