From 5f283adc8d1a29f420d466e85b216e9d6f4a9822 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 2 Jul 2021 23:17:06 +0200 Subject: Remove dependency on html tidy --- src/XpathParser.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/XpathParser.c') diff --git a/src/XpathParser.c b/src/XpathParser.c index 4326e85..0dbe270 100644 --- a/src/XpathParser.c +++ b/src/XpathParser.c @@ -19,7 +19,7 @@ static int xpath_parse_param(QuickMediaXpathParser *self, QuickMediaNodeSearchPa if(token != QUICKMEDIA_XPATH_TOKEN_IDENTIFIER) return -1; - result->name = quickmedia_xpath_tokenizer_copy_identifier(&self->tokenizer); + result->name = self->tokenizer.identifier; token = quickmedia_xpath_tokenizer_next(&self->tokenizer); if(token != QUICKMEDIA_XPATH_TOKEN_EQUAL) @@ -29,7 +29,7 @@ static int xpath_parse_param(QuickMediaXpathParser *self, QuickMediaNodeSearchPa if(token != QUICKMEDIA_XPATH_TOKEN_STRING) return -3; - result->value = quickmedia_xpath_tokenizer_copy_string(&self->tokenizer); + result->value = self->tokenizer.string; token = quickmedia_xpath_tokenizer_next(&self->tokenizer); if(token != QUICKMEDIA_XPATH_TOKEN_CLOSING_BRACKET) @@ -50,23 +50,22 @@ static int xpath_parse_node(QuickMediaXpathParser *self, QuickMediaNodeSearch *r if(token != QUICKMEDIA_XPATH_TOKEN_IDENTIFIER) return -1; - result->name = quickmedia_xpath_tokenizer_copy_identifier(&self->tokenizer); + result->name = self->tokenizer.identifier; int param_result = xpath_parse_param(self, &result->param); - if(param_result < 0) { - quickmedia_node_search_deinit(result); + if(param_result < 0) return param_result; - } result->child = malloc(sizeof(QuickMediaNodeSearch)); + if(!result->child) + return -1; + int node_result = xpath_parse_node(self, result->child); if(node_result > 0) { node_result = 0; /* Didn't have child, remove child */ free(result->child); result->child = NULL; - } else if(node_result < 0) { - quickmedia_node_search_deinit(result); } return node_result; -- cgit v1.2.3