From 9360f88d6546813d6b806a2c8418f38c35bcadd5 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Wed, 21 Dec 2005 13:48:37 +0100 Subject: [PATCH] search_dom_stack(): No need to inline this at least not while debugging --- src/document/dom/stack.c | 20 ++++++++++++++++++++ src/document/dom/stack.h | 26 +++++--------------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/document/dom/stack.c b/src/document/dom/stack.c index 984cb75a..6ad65413 100644 --- a/src/document/dom/stack.c +++ b/src/document/dom/stack.c @@ -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) { diff --git a/src/document/dom/stack.h b/src/document/dom/stack.h index c011669a..f02a2bad 100644 --- a/src/document/dom/stack.h +++ b/src/document/dom/stack.h @@ -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); -- 2.11.4.GIT