mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
Use dom_string throughout the DOM stack interface
This commit is contained in:
parent
0fab644bee
commit
87aad88c96
@ -177,13 +177,13 @@ pop_dom_node(struct dom_stack *stack)
|
||||
|
||||
void
|
||||
pop_dom_nodes(struct dom_stack *stack, enum dom_node_type type,
|
||||
unsigned char *string, uint16_t length)
|
||||
struct dom_string *string)
|
||||
{
|
||||
struct dom_stack_state *state;
|
||||
|
||||
if (!dom_stack_has_parents(stack)) return;
|
||||
|
||||
state = search_dom_stack(stack, type, string, length);
|
||||
state = search_dom_stack(stack, type, string);
|
||||
if (state)
|
||||
pop_dom_state(stack, type, state);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ get_dom_stack_state(struct dom_stack *stack, int top_offset)
|
||||
/* Dive through the stack states in search for the specified match. */
|
||||
static inline struct dom_stack_state *
|
||||
search_dom_stack(struct dom_stack *stack, enum dom_node_type type,
|
||||
unsigned char *string, uint16_t length)
|
||||
struct dom_string *string)
|
||||
{
|
||||
struct dom_stack_state *state;
|
||||
int pos;
|
||||
@ -96,8 +96,8 @@ search_dom_stack(struct dom_stack *stack, enum dom_node_type type,
|
||||
struct dom_node *parent = state->node;
|
||||
|
||||
if (parent->type == type
|
||||
&& parent->string.length == length
|
||||
&& !strncasecmp(parent->string.string, string, length))
|
||||
&& parent->string.length == string->length
|
||||
&& !strncasecmp(parent->string.string, string->string, string->length))
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ void pop_dom_node(struct dom_stack *stack);
|
||||
|
||||
/* Ascends the stack looking for specific parent */
|
||||
void pop_dom_nodes(struct dom_stack *stack, enum dom_node_type type,
|
||||
unsigned char *string, uint16_t length);
|
||||
struct dom_string *string);
|
||||
|
||||
/* Pop all stack states until a specific state is reached. */
|
||||
void
|
||||
|
@ -243,10 +243,12 @@ parse_sgml_document(struct dom_stack *stack, struct scanner *scanner)
|
||||
if (!token->length) {
|
||||
pop_dom_node(stack);
|
||||
} else {
|
||||
struct dom_string string;
|
||||
struct dom_stack_state *state;
|
||||
|
||||
set_dom_string(&string, token->string, token->length);
|
||||
state = search_dom_stack(stack, DOM_NODE_ELEMENT,
|
||||
token->string, token->length);
|
||||
&string);
|
||||
if (state) {
|
||||
struct sgml_parser_state *pstate;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user