From e3762b6517cf4d68c4a48aaae962db3d09f7da40 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 18 Nov 2023 14:58:20 -0500 Subject: [PATCH] src/svgtiny.c: remove parent == NULL hack Now that we're providing some (unused!) default user-agent properties, this code path is apparently no longer reached. Never look a gift horse in the mouth, is an insane saying. But everything works great without the NULL check, so let's remove it. --- src/svgtiny.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/svgtiny.c b/src/svgtiny.c index 91ce439..165fc21 100644 --- a/src/svgtiny.c +++ b/src/svgtiny.c @@ -2340,30 +2340,6 @@ css_select_results *svgtiny_parse_styles(dom_element *node, dom_string_unref(attr); } - struct dom_element *parent; - dom_element_parent_node(node, &parent); - if (parent == NULL) { - /* This is the root node, skip it. - * - * While initialising its selection state, libcss sets its - * node_data->bloom pointer using css__get_parent_bloom(). - * But if there is no parent, that function returns, - * - * static css_bloom empty_bloom[CSS_BLOOM_SIZE]; - * - * A problem later arises because when libcss FINALISES its - * selection state, it frees node_data->bloom! That obviously - * won't work then node has no parent, i.e. if it's the root - * element. - */ - css_stylesheet_destroy(inline_sheet); - return NULL; - } - else { - /* We only needed to know if it was NULL */ - dom_node_unref(parent); - } - code = svgtiny_select_style(state, node, inline_sheet, &styles); css_stylesheet_destroy(inline_sheet); if (code != CSS_OK) { -- 2.43.2