All pastes #756531 Raw Edit

Something

public text v1 · immutable
#756531 ·published 2007-10-31 15:41 UTC
rendered paste body
        while (g_list_length(tree->search)) {
                /* Get the first vertice from the search queue
                 * and remove it from the queue */
                vertice *current = tree->search->data;
                tree->search = g_list_remove(tree->search, current);

                /* Check if we have reached a target format */
                if (target_fn(fndata, current->format)) {
                        /* Done. return the result */
                        result = current;
                        break;
                }

                /* If we dont have reached a target, we look at our neighbours */
                while ((neighbour = _get_next_vertice_neighbour(env, tree, current, error))) {
                        /* We found a neighbour and insert it sorted in our search queue */
                        tree->search = g_list_insert_sorted(tree->search, neighbour, _compare_vertice_distance);
                }
                if (osync_error_is_set(error))
                        goto error_free_tree;

                /* Done, drop the reference to the vertice */
                _free_vertice(current);
        }