[prev in list] [next in list] [prev in thread] [next in thread]
List: elinks-cvs
Subject: [ELinks] elinks (ECMASCRIPT) - jonas: push_dom_node(): Cleanup.
From: cvs () pasky ! ji ! cz
Date: 2004-02-28 20:49:34
Message-ID: 20040228204934.25525.qmail () machine ! sinus ! cz
[Download RAW message or body]
This is an automated notification of a change to the ELinks CVS tree.
Author: jonas
Module: elinks
Tag: ECMASCRIPT
Date: Sat Feb 28 20:49:34 2004 GMT
---- Log message:
push_dom_node(): Cleanup.
---- Files affected:
elinks/src/document/dom:
navigator.c (1.1.2.34 -> 1.1.2.35)
http://cvsweb.elinks.or.cz/cvsweb.cgi/elinks/src/document/dom/navigator.c.diff?r1=1.1.2.34&r2=1.1.2.35&f=u
---- Diffs:
elinks/src/document/dom/navigator.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
Index: elinks/src/document/dom/navigator.c
diff -u elinks/src/document/dom/navigator.c:1.1.2.34 \
elinks/src/document/dom/navigator.c:1.1.2.35
--- elinks/src/document/dom/navigator.c:1.1.2.34 Sat Feb 28 21:40:57 2004
+++ elinks/src/document/dom/navigator.c Sat Feb 28 21:49:28 2004
@@ -69,7 +69,7 @@
push_dom_node(struct dom_navigator *navigator, struct dom_node *node, ...)
{
dom_navigator_callback_T callback = navigator->callbacks[node->type];
- struct dom_navigator_state *states;
+ struct dom_navigator_state *state;
assert(navigator && node);
@@ -78,12 +78,14 @@
return NULL;
}
- states = realloc_dom_navigator_states(&navigator->states, navigator->depth);
- if (!states) {
+ state = realloc_dom_navigator_states(&navigator->states, navigator->depth);
+ if (!state) {
done_dom_node(node);
return NULL;
}
+ state += navigator->depth;
+
if (navigator->object_size) {
unsigned char *state_objects;
size_t offset = navigator->depth * navigator->object_size;
@@ -94,12 +96,14 @@
return NULL;
}
- states[navigator->depth].data = (void *) &state_objects[offset];
+ state->data = (void *) &state_objects[offset];
}
+ state->node = node;
+
/* Grow the state array to the new depth so the state accessors work
* in the callbacks */
- states[navigator->depth++].node = node;
+ navigator->depth++;
if (callback) {
va_list args;
@@ -109,7 +113,10 @@
va_end(args);
/* If the callback returned NULL pop the state immediately */
- if (!node) navigator->depth--;
+ if (!node) {
+ memset(state, 0, sizeof(struct dom_navigator_state));
+ navigator->depth--;
+ }
}
return node;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic