From d079b656b4719739b2247dcd9d46e9bec793095a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 Feb 2023 17:11:34 +0100 Subject: Merging upstream version 1.38.0. Signed-off-by: Daniel Baumann --- parser/README.md | 25 +++++++++++++++---------- parser/parser.c | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) (limited to 'parser') diff --git a/parser/README.md b/parser/README.md index c01972df6..b7951864f 100644 --- a/parser/README.md +++ b/parser/README.md @@ -1,3 +1,9 @@ + + + #### Introduction The parser will be used to process streaming and plugins input as well as metadata @@ -18,7 +24,8 @@ Usage #### Functions ----- +TODO: + ##### parse_init(RRDHOST *host, void *user, void *input, int flags) Initialize an internal parser with the specified user defined data structure that will be shared across calls. @@ -38,7 +45,6 @@ Output ----- ##### parse_push(PARSER *parser, char *line) Push a new line for processing @@ -58,7 +64,7 @@ Returns - 0 line added - 1 error detected ----- + ##### parse_add_keyword(PARSER *parser, char *keyword, keyword_function callback_function) The function will add callbacks for keywords. The callback function is defined as @@ -74,9 +80,9 @@ Input - keyword_function - The callback that will handle the keyword processing * The callback function should return one of the following - * PARSER_RC_OK -- Callback was successful (continue with other callbacks) - * PARSER_RC_STOP -- Stop processing callbacks (return OK) - * PARSER_RC_ERROR -- Callback failed, exit + * PARSER_RC_OK - Callback was successful (continue with other callbacks) + * PARSER_RC_STOP - Stop processing callbacks (return OK) + * PARSER_RC_ERROR - Callback failed, exit Output - The corresponding keyword and callback will be registered @@ -86,7 +92,6 @@ Returns - > 0 which is the number of callbacks associated with this keyword. ----- ##### parser_next(PARSER *parser) Return the next item to parse @@ -101,7 +106,7 @@ Returns - 0 Next item fetched successfully - 1 No more items to parse ----- + ##### parser_action(PARSER *parser, char *input) Return the next item to parse @@ -118,7 +123,7 @@ Returns - 0 Callbacks called successfully - 1 Failed ----- + ##### parser_destroy(PARSER *parser) Cleanup a previously allocated parser @@ -132,7 +137,7 @@ Output Returns - none ----- + ##### parser_recover_input(PARSER *parser) Cleanup a previously allocated parser diff --git a/parser/parser.c b/parser/parser.c index 5b4c528de..c687c7af4 100644 --- a/parser/parser.c +++ b/parser/parser.c @@ -357,7 +357,7 @@ inline int parser_action(PARSER *parser, char *input) #ifdef NETDATA_INTERNAL_CHECKS if(rc == PARSER_RC_ERROR) { - BUFFER *wb = buffer_create(PLUGINSD_LINE_MAX); + BUFFER *wb = buffer_create(PLUGINSD_LINE_MAX, NULL); for(size_t i = 0; i < num_words ;i++) { if(i) buffer_fast_strcat(wb, " ", 1); -- cgit v1.2.3