src/lib/message_queue.c in trema-0.2.5 vs src/lib/message_queue.c in trema-0.2.6

- old
+ new

@@ -40,11 +40,11 @@ delete_message_queue( message_queue *queue ) { if ( queue == NULL ) { die( "queue must not be NULL" ); } - while( queue->head != NULL ) { + while ( queue->head != NULL ) { message_queue_element *element = queue->head; if ( queue->head->data != NULL ) { free_buffer( element->data ); } queue->head = queue->head->next; @@ -120,18 +120,20 @@ return queue->divider->next->data; } -void foreach_message_queue( message_queue *queue, void function( buffer *message, void *user_data ), void *user_data ) { +void foreach_message_queue( message_queue *queue, bool function( buffer *message, void *user_data ), void *user_data ) { if ( queue->divider == queue->tail ) { return; } message_queue_element *element; for ( element = queue->divider->next; element != NULL; element = element->next ) { buffer *message = element->data; assert( message != NULL ); - function( message, user_data ); + if ( !function( message, user_data ) ) { + break; + } } } /*