mirror of
https://github.com/apache/httpd.git
synced 2026-01-20 04:06:16 +03:00
add some debugging code -- verifies that the heap property is satisfied
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96367 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -336,3 +336,19 @@ void cache_pq_print(cache_pqueue_t *q,
|
||||
}
|
||||
cache_pq_free(dup);
|
||||
}
|
||||
|
||||
static int cache_pq_subtree_is_valid(cache_pqueue_t *q, int pos)
|
||||
{
|
||||
if ((left(pos) <q->size &&(q->pri(q->d[pos]) < q->pri(q->d[left(pos)]))) ||
|
||||
(right(pos)<q->size &&(q->pri(q->d[pos]) < q->pri(q->d[right(pos)]))))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ((left(pos)>=q->size ||(cache_pq_subtree_is_valid(q, left(pos)))) &&
|
||||
(right(pos)>=q->size||(cache_pq_subtree_is_valid(q, right(pos)))));
|
||||
}
|
||||
|
||||
int cache_pq_is_valid(cache_pqueue_t *q)
|
||||
{
|
||||
return cache_pq_subtree_is_valid(q, 1);
|
||||
}
|
||||
|
||||
@@ -187,6 +187,14 @@ void cache_pq_dump(cache_pqueue_t *q,
|
||||
FILE *out,
|
||||
cache_pqueue_print_entry print);
|
||||
|
||||
/**
|
||||
* checks that the pq is in the right order, etc
|
||||
* @internal
|
||||
* debug function only
|
||||
* @param q the queue
|
||||
*/
|
||||
int cache_pq_is_valid(cache_pqueue_t *q);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user