diff options
Diffstat (limited to 'contrib/libcbor/src/cbor/internal/stack.h')
-rw-r--r-- | contrib/libcbor/src/cbor/internal/stack.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/contrib/libcbor/src/cbor/internal/stack.h b/contrib/libcbor/src/cbor/internal/stack.h index 42ed04429c7e..cf2206b40e58 100644 --- a/contrib/libcbor/src/cbor/internal/stack.h +++ b/contrib/libcbor/src/cbor/internal/stack.h @@ -16,8 +16,18 @@ extern "C" { /** Simple stack record for the parser */ struct _cbor_stack_record { + /** Pointer to the parent stack frame */ struct _cbor_stack_record *lower; + /** Item under construction */ cbor_item_t *item; + /** + * How many outstanding subitems are expected. + * + * For example, when we see a new definite array, `subitems` is initialized to + * the array length. With every item added, the counter is decreased. When it + * reaches zero, the stack is popped and the complete item is propagated + * upwards. + */ size_t subitems; }; @@ -27,10 +37,12 @@ struct _cbor_stack { size_t size; }; -struct _cbor_stack _cbor_stack_init(); +_CBOR_NODISCARD +struct _cbor_stack _cbor_stack_init(void); void _cbor_stack_pop(struct _cbor_stack *); +_CBOR_NODISCARD struct _cbor_stack_record *_cbor_stack_push(struct _cbor_stack *, cbor_item_t *, size_t); |