From a8ab6484c1cf08bb5669b2f46f933845cc81f077 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 23 Oct 2017 22:47:46 +0200 Subject: Implement the .line filter Close #48 --- src/sp_config_keywords.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/sp_config_keywords.c') diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index 097d08b..168ee1c 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c @@ -145,6 +145,7 @@ int parse_disabled_functions(char *line) { int ret = 0; bool enable = true, disable = false; char *pos = NULL; + char *line_number = NULL; sp_disabled_function *df = pecalloc(sizeof(*df), 1, 1); df->pos = -1; @@ -172,6 +173,7 @@ int parse_disabled_functions(char *line) { {parse_php_type, SP_TOKEN_RET_TYPE, &(df->ret_type)}, {parse_str, SP_TOKEN_LOCAL_VAR, &(df->var)}, {parse_str, SP_TOKEN_VALUE_ARG_POS, &(pos)}, + {parse_str, SP_TOKEN_LINE_NUMBER, &(line_number)}, {0}}; ret = parse_keywords(sp_config_funcs_disabled_functions, line); @@ -252,6 +254,17 @@ int parse_disabled_functions(char *line) { } } + if (line_number) { + errno = 0; + char *endptr; + df->line = strtoul(line_number, &endptr, 10); + if (errno != 0 || endptr == line_number) { + sp_log_err("config", "Failed to parse arg '%s' of `line` on line %zu.", + line_number, sp_line_no); + return -1; + } + } + if (df->function) { df->functions_list = parse_functions_list(df->function); } -- cgit v1.3