Skip to content

Commit d352a9a

Browse files
committed
WSHUB-458: cborparser: Update documentation
1 parent 8d699d3 commit d352a9a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/cborparser.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,16 +373,19 @@ CborError cbor_parser_init(const uint8_t *buffer, size_t size, uint32_t flags, C
373373
* The \a ops structure defines functions that implement the read process from
374374
* the buffer given, see \ref CborParserOperations for further details.
375375
*
376-
* The \a token is passed as the first argument to all
377-
* \ref CborParserOperations methods, and may be used to pass additional
378-
* context information to the reader implementation.
376+
* The \a ctx is stored in the \ref CborParser object as `data.ctx` and may be
377+
* used however the reader implementation sees fit. For cursor-specific
378+
* context information, the \ref CborValue `source.token` union member is
379+
* initialised to `NULL` and may be used however the reader implementation
380+
* sees fit.
379381
*/
380-
CborError cbor_parser_init_reader(const struct CborParserOperations *ops, CborParser *parser, CborValue *it, void *token)
382+
CborError cbor_parser_init_reader(const struct CborParserOperations *ops, CborParser *parser, CborValue *it, void *ctx)
381383
{
382384
cbor_parser_init_common(parser, it);
383385
parser->ops = ops;
384386
parser->flags = CborParserFlag_ExternalSource;
385-
parser->data.ctx = token;
387+
parser->data.ctx = ctx;
388+
it->source.token = NULL;
386389
return preparse_value(it);
387390
}
388391

0 commit comments

Comments
 (0)