Skip to content

Commit 357a875

Browse files
committed
cborparser: Update documentation
1 parent b931e0a commit 357a875

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
@@ -372,16 +372,19 @@ CborError cbor_parser_init(const uint8_t *buffer, size_t size, uint32_t flags, C
372372
* The \a ops structure defines functions that implement the read process from
373373
* the buffer given, see \ref CborParserOperations for further details.
374374
*
375-
* The \a token is passed as the first argument to all
376-
* \ref CborParserOperations methods, and may be used to pass additional
377-
* context information to the reader implementation.
375+
* The \a ctx is stored in the \ref CborParser object as `data.ctx` and may be
376+
* used however the reader implementation sees fit. For cursor-specific
377+
* context information, the \ref CborValue `source.token` union member is
378+
* initialised to `NULL` and may be used however the reader implementation
379+
* sees fit.
378380
*/
379-
CborError cbor_parser_init_reader(const struct CborParserOperations *ops, CborParser *parser, CborValue *it, void *token)
381+
CborError cbor_parser_init_reader(const struct CborParserOperations *ops, CborParser *parser, CborValue *it, void *ctx)
380382
{
381383
cbor_parser_init_common(parser, it);
382384
parser->ops = ops;
383385
parser->flags = CborParserFlag_ExternalSource;
384-
parser->data.ctx = token;
386+
parser->data.ctx = ctx;
387+
it->source.token = NULL;
385388
return preparse_value(it);
386389
}
387390

0 commit comments

Comments
 (0)