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

search_dom_stack(): No need to inline this at least not while debugging

This commit is contained in:
Jonas Fonseca 2005-12-21 13:48:37 +01:00 committed by Jonas Fonseca
parent 779a8a4553
commit 9360f88d65
2 changed files with 25 additions and 21 deletions

View File

@ -242,6 +242,26 @@ pop_dom_state(struct dom_stack *stack, struct dom_stack_state *target)
}
}
struct dom_stack_state *
search_dom_stack(struct dom_stack *stack, enum dom_node_type type,
struct dom_string *string)
{
struct dom_stack_state *state;
int pos;
/* FIXME: Take node subtype and compare if non-zero or something. */
foreachback_dom_stack_state (stack, state, pos) {
struct dom_node *parent = state->node;
if (parent->type == type
&& parent->string.length == string->length
&& !strncasecmp(parent->string.string, string->string, string->length))
return state;
}
return NULL;
}
void
walk_dom_nodes(struct dom_stack *stack, struct dom_node *root)
{

View File

@ -106,27 +106,6 @@ get_dom_stack_state(struct dom_stack *stack, int top_offset)
for ((pos) = (stack)->depth - 1; (pos) >= 0; (pos)--) \
if (((state) = &(stack)->states[(pos)]))
/* 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,
struct dom_string *string)
{
struct dom_stack_state *state;
int pos;
/* FIXME: Take node subtype and compare if non-zero or something. */
foreachback_dom_stack_state (stack, state, pos) {
struct dom_node *parent = state->node;
if (parent->type == type
&& parent->string.length == string->length
&& !strncasecmp(parent->string.string, string->string, string->length))
return state;
}
return NULL;
}
/* Life cycle functions. */
@ -153,6 +132,11 @@ void pop_dom_nodes(struct dom_stack *stack, enum dom_node_type type,
/* Pop all stack states until a specific state is reached. */
void pop_dom_state(struct dom_stack *stack, struct dom_stack_state *target);
/* Dive through the stack states in search for the specified match. */
struct dom_stack_state *
search_dom_stack(struct dom_stack *stack, enum dom_node_type type,
struct dom_string *string);
/* Visit each node in the tree rooted at @root pre-order */
void walk_dom_nodes(struct dom_stack *stack, struct dom_node *root);