1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Cleanup the DOM stack flags; s/KEEP_NODES/FREE_NODES/

This commit is contained in:
Jonas Fonseca 2006-01-03 20:35:32 +01:00 committed by Jonas Fonseca
parent 7a5f699a88
commit 66cf866ab6
4 changed files with 10 additions and 8 deletions

View File

@ -530,7 +530,7 @@ init_dom_select(enum dom_select_syntax syntax, struct dom_string *string)
struct dom_stack stack;
enum dom_exception_code code;
init_dom_stack(&stack, DOM_STACK_KEEP_NODES);
init_dom_stack(&stack, DOM_STACK_FLAG_NONE);
add_dom_stack_tracer(&stack, "init-select: ");
code = parse_dom_select(select, &stack, string);
@ -1060,12 +1060,12 @@ select_dom_nodes(struct dom_select *select, struct dom_node *root)
select_data.select = select;;
init_dom_stack(&stack, DOM_STACK_KEEP_NODES);
init_dom_stack(&stack, DOM_STACK_FLAG_NONE);
add_dom_stack_context(&stack, &select_data,
&dom_select_context_info);
add_dom_stack_tracer(&stack, "select-tree: ");
init_dom_stack(&select_data.stack, DOM_STACK_KEEP_NODES);
init_dom_stack(&select_data.stack, DOM_STACK_FLAG_NONE);
add_dom_stack_context(&select_data.stack, &select_data,
&dom_select_data_context_info);
add_dom_stack_tracer(&select_data.stack, "select-match: ");

View File

@ -557,8 +557,8 @@ init_sgml_parser(enum sgml_parser_type type, enum sgml_document_type doctype,
parser->flags = flags;
parser->info = get_sgml_info(doctype);
if (type == SGML_PARSER_TREE)
stack_flags |= DOM_STACK_KEEP_NODES;
if (type == SGML_PARSER_STREAM)
stack_flags |= DOM_STACK_FLAG_FREE_NODES;
init_dom_stack(&parser->stack, stack_flags);
/* FIXME: Some sgml backend specific callbacks? Handle HTML script tags,

View File

@ -213,7 +213,7 @@ pop_dom_node(struct dom_stack *stack)
call_dom_stack_callbacks(stack, state, DOM_STACK_POP);
if (!(stack->flags & DOM_STACK_KEEP_NODES))
if (stack->flags & DOM_STACK_FLAG_FREE_NODES)
done_dom_node(state->node);
stack->depth--;

View File

@ -48,8 +48,10 @@ struct dom_stack_context {
};
enum dom_stack_flag {
/* Keep nodes when popping them or call done_dom_node() on them. */
DOM_STACK_KEEP_NODES = 1,
DOM_STACK_FLAG_NONE = 0,
/* Free nodes when popping them by calling done_dom_node(). */
DOM_STACK_FLAG_FREE_NODES = 1,
};
/* The DOM stack is a convenient way to traverse DOM trees. Also it