pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:5865:
if (node->refs != 2) { Pike_fatal("Unexpected number of references for node: %d\n", node->refs); } #endif /* PIKE_DEBUG */ unlink_list_node(node); node = next; } }
-
/*
These
two
functions perform the same thing,
-
* but are optimized to minimize recursion.
-
*/
-
static void
gc_check
_list_node_backward(struct
pike_list_node
*
node,
-
const char *msg);
-
static void gc
_
check_list_node_forward(struct pike_list_node *node,
-
const char *msg)
+
/*
Called
at
gc_check
time.
*
/
+
GC
_
CHECK
{
-
while
(node && !debug
_
gc
_
check(&
node
->refs,
msg)) {
-
if (
node
->next)
-
debug_gc_check_svalues(&node
->
val, 1, " as a list node value")
;
-
gc
_
check_
list_node
_backward(node->prev,
msg);
-
node = node->
next;
-
}
-
}
+
struct
pike
_
list
_node
*
node
=
THIS
->
head
;
+
struct
pike
_list_node
*
next;
-
static
void
gc_check_list_node_backward(struct pike_list_node *node,
-
const char *msg)
-
{
-
while (
node
&&
!debug_gc_check(&
node->
refs, msg
)) {
-
if (node->prev)
-
debug_gc_check_svalues(&node->val, 1, "
as a list node value");
-
gc_check_list_
node
_forward(node->next,
msg);
-
node
=
node->prev
;
+
while (
(next
=
node->
next
)) {
+
debug_gc_check_svalues(&node->val, 1, "as a list node value");
+
node =
next
;
} }
-
/* Called at gc_check time. */
-
GC_CHECK
-
{
-
gc_check_list_node_backward(HEAD_SENTINEL(THIS), " as a list node");
-
gc_check_list_node_forward(TAIL_SENTINEL(THIS), " as a list node");
-
}
-
+
/* Called at gc_mark time */ GC_RECURSE { struct pike_list_node *node = THIS->head; struct pike_list_node *next; while ((next = node->next)) { gc_recurse_svalues(&node->val, 1); node = next; } /* FIXME: mc_count_bytes */
pike.git/src/builtin.cmod:6243:
EXIT gc_trivial; { if (THIS->cur) { free_list_node(THIS->cur); THIS->cur = NULL; } }
-
/* Called at gc_check time. */
-
GC_CHECK
-
{
-
gc_check_list_node_forward(THIS->cur, " held by an iterator");
-
}
-
+
/* These two functions perform the same thing, * but are optimized to minimize recursion. */ static void gc_recurse_list_node_tree_backward(struct pike_list_node *node, struct pike_list_node *back); static void gc_recurse_list_node_tree_forward(struct pike_list_node *node, struct pike_list_node *back) { if (!node || !node->next) return; if (node->next->prev == node) {