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

Rename: dom_stack_has_parents() -> dom_stack_is_empty() (with negated value)

This commit is contained in:
Jonas Fonseca 2005-12-19 02:15:36 +01:00 committed by Jonas Fonseca
parent bc338207e7
commit ee1eba9689
2 changed files with 12 additions and 7 deletions

View File

@ -137,7 +137,7 @@ do_pop_dom_node(struct dom_stack *stack, struct dom_stack_state *parent)
struct dom_stack_state *state;
dom_stack_callback_T callback;
assert(stack && dom_stack_has_parents(stack));
assert(stack && !dom_stack_is_empty(stack));
state = get_dom_stack_top(stack);
callback = stack->pop_callbacks[state->node->type];
@ -168,7 +168,8 @@ void
pop_dom_node(struct dom_stack *stack)
{
assert(stack);
if (!dom_stack_has_parents(stack)) return;
if (dom_stack_is_empty(stack)) return;
do_pop_dom_node(stack, get_dom_stack_parent(stack));
}
@ -179,7 +180,9 @@ pop_dom_nodes(struct dom_stack *stack, enum dom_node_type type,
{
struct dom_stack_state *state;
if (!dom_stack_has_parents(stack)) return;
assert(stack);
if (dom_stack_is_empty(stack)) return;
state = search_dom_stack(stack, type, string);
if (state)
@ -192,9 +195,11 @@ pop_dom_state(struct dom_stack *stack, struct dom_stack_state *target)
struct dom_stack_state *state;
unsigned int pos;
assert(stack);
if (!target) return;
if (!dom_stack_has_parents(stack)) return;
if (dom_stack_is_empty(stack)) return;
foreachback_dom_state (stack, state, pos) {
if (do_pop_dom_node(stack, target))
@ -209,7 +214,7 @@ walk_dom_nodes(struct dom_stack *stack, struct dom_node *root)
push_dom_node(stack, root);
while (dom_stack_has_parents(stack)) {
while (!dom_stack_is_empty(stack)) {
struct dom_stack_state *state = get_dom_stack_top(stack);
struct dom_node_list *list = state->list;
struct dom_node *node = state->node;

View File

@ -55,8 +55,8 @@ struct dom_stack {
void *data;
};
#define dom_stack_has_parents(stack) \
((stack)->states && (stack)->depth > 0)
#define dom_stack_is_empty(stack) \
(!(stack)->states || (stack)->depth == 0)
static inline struct dom_stack_state *
get_dom_stack_state(struct dom_stack *stack, int top_offset)