From 9b11f4105eacc2af8828b65fd946e2b584cdee7e Mon Sep 17 00:00:00 2001 From: jvoisin Date: Tue, 3 May 2022 00:12:47 +0200 Subject: Speed up a tiny bit `sp_parse_var` --- src/sp_var_parser.c | 6 +++--- src/sp_var_parser.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/sp_var_parser.c b/src/sp_var_parser.c index 2639991..e7ff766 100644 --- a/src/sp_var_parser.c +++ b/src/sp_var_parser.c @@ -245,15 +245,15 @@ static sp_tree *parse_tokens(const char *restrict str, } sp_tree *sp_parse_var(const char *line) { - sp_list_node *tokens_list = NULL; - sp_tree *tree = NULL; - const sp_conf_token delimiter_list[] = { + static const sp_conf_token delimiter_list[] = { {.type = OBJECT, .text_repr = OBJECT_TOKEN}, {.type = ARRAY, .text_repr = ARRAY_TOKEN}, {.type = ARRAY_END, .text_repr = ARRAY_END_TOKEN}, {.type = INTERPRETED_STRING, .text_repr = STRING_TOKEN}, {.type = LITERAL_STRING, .text_repr = ESC_STRING_TOKEN}, {.type = CLASS, .text_repr = CLASS_TOKEN}}; + sp_list_node *tokens_list = NULL; + sp_tree *tree = NULL; if (!line) { return NULL; diff --git a/src/sp_var_parser.h b/src/sp_var_parser.h index 6d53691..c2981a3 100644 --- a/src/sp_var_parser.h +++ b/src/sp_var_parser.h @@ -4,7 +4,7 @@ typedef struct sp_token_s { elem_type type; - char *text_repr; + const char *text_repr; size_t pos; } sp_conf_token; -- cgit v1.3