aboutsummaryrefslogtreecommitdiff
path: root/src/schedule.c
diff options
context:
space:
mode:
authorMarvin Borner2023-06-07 23:31:47 +0200
committerMarvin Borner2023-06-07 23:31:47 +0200
commitacab739b55824f508dd61de9ab8ef91c18b1a086 (patch)
treea4a6adb2b758488ce6666b94c2fa52ba470eef45 /src/schedule.c
parent1e728c2455fdc696e260f87d0d523a3de6d43a00 (diff)
Further fixes of substitution and use-after-free
Diffstat (limited to 'src/schedule.c')
-rw-r--r--src/schedule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/schedule.c b/src/schedule.c
index 407c6e0..458d8a2 100644
--- a/src/schedule.c
+++ b/src/schedule.c
@@ -69,7 +69,7 @@ void schedule_add(struct term *term)
void schedule_remove(struct term *term)
{
- if (!term_is_beta_redex(term))
+ if (!pqueue_size(queue) || !term_is_beta_redex(term))
return;
int error = pqueue_remove(queue, term);
@@ -78,9 +78,9 @@ void schedule_remove(struct term *term)
void schedule(void)
{
- while (pqueue_size(queue) > 1) {
- fprintf(stderr, "queue size: %zu\n", pqueue_size(queue));
- map_dump(map_all_terms());
+ while (pqueue_size(queue)) {
+ debug("queue size: %zu\n", pqueue_size(queue));
+ map_dump(map_all_terms(), 1);
// TODO: check finished programs
size_t position = choose_position();