Skip to content

Commit dd7f9fe

Browse files
committed
api: add a comment about settings lifetime
See: #55 (comment)
1 parent 6c92a79 commit dd7f9fe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/native/api.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ struct llhttp_settings_s {
4444
llhttp_cb on_chunk_complete;
4545
};
4646

47-
/* Initialize the parser with specific type and user settings */
47+
/* Initialize the parser with specific type and user settings.
48+
*
49+
* NOTE: lifetime of `settings` has to be at least the same as the lifetime of
50+
* the `parser` here. In practice, `settings` has to be either a static
51+
* variable or be allocated with `malloc`, `new`, etc.
52+
*/
4853
void llhttp_init(llhttp_t* parser, llhttp_type_t type,
4954
const llhttp_settings_t* settings);
5055

0 commit comments

Comments
 (0)