diff --git a/queries.c b/queries.c index 9876bf3..25154af 100644 --- a/queries.c +++ b/queries.c @@ -51,7 +51,6 @@ double get_double_time (void) { } struct query *query_get (long long id) { - tree_check_query (queries_tree); return tree_lookup_query (queries_tree, (void *)&id); } @@ -105,7 +104,6 @@ struct query *send_query (struct dc *DC, int ints, void *data, struct query_meth void query_ack (long long id) { struct query *q = query_get (id); if (q && !(q->flags & QUERY_ACK_RECEIVED)) { - tree_check_query (queries_tree); assert (q->msg_id == id); q->flags |= QUERY_ACK_RECEIVED; remove_event_timer (&q->ev); @@ -213,18 +211,14 @@ void insert_event_timer (struct event_timer *ev) { if (verbosity > 2) { logprintf ( "INSERT: %lf %p %p\n", ev->timeout, ev->self, ev->alarm); } - tree_check_timer (timer_tree); timer_tree = tree_insert_timer (timer_tree, ev, lrand48 ()); - tree_check_timer (timer_tree); } void remove_event_timer (struct event_timer *ev) { if (verbosity > 2) { logprintf ( "REMOVE: %lf %p %p\n", ev->timeout, ev->self, ev->alarm); } - tree_check_timer (timer_tree); timer_tree = tree_delete_timer (timer_tree, ev); - tree_check_timer (timer_tree); } double next_timer_in (void) { diff --git a/tree.h b/tree.h index 04710f8..8f38e17 100644 --- a/tree.h +++ b/tree.h @@ -101,7 +101,12 @@ struct tree_ ## X_NAME *tree_delete_ ## X_NAME (struct tree_ ## X_NAME *T, X_TYP delete_tree_node_ ## X_NAME (T);\ return N;\ } else {\ - return tree_delete_ ## X_NAME (c < 0 ? T->left : T->right, x);\ + if (c < 0) { \ + T->left = tree_delete_ ## X_NAME (T->left, x); \ + } else { \ + T->right = tree_delete_ ## X_NAME (T->right, x); \ + } \ + return T; \ }\ }\ \