mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Drop the return value from dom_stack_callback_T
... since the feature with popping the node if the return value is NULL is not used and it doesn't make a lot of sense with multiple callbacks.
This commit is contained in:
parent
990c5e0a26
commit
d6b125fa68
@ -439,7 +439,7 @@ set_enhanced_dom_node_value(struct dom_string *string, struct dom_node *node,
|
||||
string->length = string->string ? strlen(string->string) : 0;
|
||||
}
|
||||
|
||||
static struct dom_node *
|
||||
static void
|
||||
render_dom_tree(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct dom_renderer *renderer = stack->renderer;
|
||||
@ -456,7 +456,7 @@ render_dom_tree(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct dom_node *
|
||||
static void
|
||||
render_dom_tree_id_leaf(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct dom_renderer *renderer = stack->renderer;
|
||||
@ -483,7 +483,7 @@ render_dom_tree_id_leaf(struct dom_stack *stack, struct dom_node *node, void *da
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct dom_node *
|
||||
static void
|
||||
render_dom_tree_leaf(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct dom_renderer *renderer = stack->renderer;
|
||||
@ -508,7 +508,7 @@ render_dom_tree_leaf(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct dom_node *
|
||||
static void
|
||||
render_dom_tree_branch(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct dom_renderer *renderer = stack->renderer;
|
||||
@ -594,7 +594,7 @@ render_dom_node_text(struct dom_renderer *renderer, struct screen_char *template
|
||||
render_dom_text(renderer, template, string, length);
|
||||
}
|
||||
|
||||
static struct dom_node *
|
||||
static void
|
||||
render_dom_node_source(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct sgml_parser *parser = stack->data;
|
||||
@ -605,12 +605,10 @@ render_dom_node_source(struct dom_stack *stack, struct dom_node *node, void *dat
|
||||
/* TODO: For (atleast) text, CDATA section and comment nodes check
|
||||
* for URIs ala document->options.plain_display_links */
|
||||
render_dom_node_text(renderer, &renderer->styles[node->type], node);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
/* This callback is also used for rendering processing instruction nodes. */
|
||||
static struct dom_node *
|
||||
static void
|
||||
render_dom_element_source(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct sgml_parser *parser = stack->data;
|
||||
@ -619,11 +617,9 @@ render_dom_element_source(struct dom_stack *stack, struct dom_node *node, void *
|
||||
assert(node && renderer && renderer->document);
|
||||
|
||||
render_dom_node_text(renderer, &renderer->styles[node->type], node);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct dom_node *
|
||||
static void
|
||||
render_dom_element_end_source(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct sgml_parser *parser = stack->data;
|
||||
@ -636,7 +632,7 @@ render_dom_element_end_source(struct dom_stack *stack, struct dom_node *node, vo
|
||||
assert(node && renderer && renderer->document);
|
||||
|
||||
if (!string || !length)
|
||||
return node;
|
||||
return;
|
||||
|
||||
if (check_dom_node_source(renderer, string, length)) {
|
||||
render_dom_flush(renderer, string);
|
||||
@ -645,11 +641,9 @@ render_dom_element_end_source(struct dom_stack *stack, struct dom_node *node, vo
|
||||
}
|
||||
|
||||
render_dom_text(renderer, &renderer->styles[node->type], string, length);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct dom_node *
|
||||
static void
|
||||
render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct sgml_parser *parser = stack->data;
|
||||
@ -737,8 +731,6 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void
|
||||
render_dom_text(renderer, template, value, valuelen);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct dom_stack_callbacks dom_source_renderer_callbacks = {
|
||||
|
@ -655,7 +655,7 @@ match_attribute_selectors(struct dom_select_node *base, struct dom_node *node)
|
||||
#define has_element_match(selector, name) \
|
||||
((selector)->match.element & (name))
|
||||
|
||||
static struct dom_node *
|
||||
static void
|
||||
dom_select_push_element(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct dom_select_data *select_data = stack->data;
|
||||
@ -723,11 +723,9 @@ dom_select_push_element(struct dom_stack *stack, struct dom_node *node, void *da
|
||||
if (selector)
|
||||
push_dom_node(&select_data->stack, &selector->node);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct dom_node *
|
||||
static void
|
||||
dom_select_pop_element(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct dom_select_data *select_data = stack->data;
|
||||
@ -758,11 +756,9 @@ dom_select_pop_element(struct dom_stack *stack, struct dom_node *node, void *dat
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct dom_node *
|
||||
static void
|
||||
dom_select_push_text(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
{
|
||||
struct dom_select_data *select_data = stack->data;
|
||||
@ -774,7 +770,7 @@ dom_select_push_text(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
WDBG("Text node: %d chars", node->string.length);
|
||||
|
||||
if (!text_sel)
|
||||
return node;
|
||||
return;
|
||||
|
||||
text = &text_sel->node.string;
|
||||
|
||||
@ -786,8 +782,6 @@ dom_select_push_text(struct dom_stack *stack, struct dom_node *node, void *data)
|
||||
default:
|
||||
ERROR("Unhandled type");
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static struct dom_stack_callbacks dom_select_callbacks = {
|
||||
|
@ -113,14 +113,7 @@ push_dom_node(struct dom_stack *stack, struct dom_node *node)
|
||||
if (callback) {
|
||||
void *state_data = get_dom_stack_state_data(stack, state);
|
||||
|
||||
node = callback(stack, node, state_data);
|
||||
|
||||
/* If the callback returned NULL pop the state immediately */
|
||||
if (!node) {
|
||||
memset(state, 0, sizeof(*state));
|
||||
stack->depth--;
|
||||
assert(stack->depth >= 0);
|
||||
}
|
||||
callback(stack, node, state_data);
|
||||
}
|
||||
|
||||
return node;
|
||||
|
@ -8,8 +8,7 @@
|
||||
|
||||
struct dom_stack;
|
||||
|
||||
typedef struct dom_node *
|
||||
(*dom_stack_callback_T)(struct dom_stack *, struct dom_node *, void *);
|
||||
typedef void (*dom_stack_callback_T)(struct dom_stack *, struct dom_node *, void *);
|
||||
|
||||
struct dom_stack_callbacks {
|
||||
dom_stack_callback_T push[DOM_NODES];
|
||||
|
Loading…
Reference in New Issue
Block a user