<commit_before>#include "xinebackend.h"
#include <xine.h>
#include <xine/xineutils.h>

#ifndef XINE_STREAM_COUNT
#define XINE_STREAM_COUNT 3
#endif

struct Node {
    Node() : stream(0), next(0) {}

    xine_stream_t *stream;
    QString track;
    Node *next;
};

void swap(Node *left, Node *right)
{
    qSwap(left->stream, right->stream);
    qSwap(left->track, right->track);
    qSwap(left->next, right->next);
}

static bool initStream(Node *node, const QString &fileName)
{
    xine_close(node->stream);
    if (!xine_open(node->stream, qPrintable(fileName))) {
        printf("Unable to open path '%s'\n", qPrintable(fileName));
        return false;
    }
    Q_ASSERT(node->track != fileName);
    node->track = fileName;
    return true;
}

struct Private
{
    Private() : xine(0), first(0), ao_port(0), event_queue(0),
                status(Backend::Uninitalized), error(XINE_ERROR_NONE),
                progressType(Backend::Seconds), pendingProgress(0)
    {}

    xine_stream_t *stream(const QString &fileName, Node **out = 0)
    {
        if (main.track == fileName) {
            if (out)
                *out = &main;
            return main.stream;
        }
        Node *last = 0;
        Node *node = first;
        forever {
            if (node->track == fileName) {
                if (out)
                    *out = node;
                return node->stream;
            } else if (node->next) {<commit_msg>make it work. hopefully<commit_after>#include "xinebackend.h"
#include <xine.h>
#include <xine/xineutils.h>

#ifndef XINE_STREAM_COUNT
#define XINE_STREAM_COUNT 3
#endif

struct Node {
    Node() : stream(0), next(0) {}

    xine_stream_t *stream;
    QString track;
    Node *next;
};

void swap(Node *left, Node *right)
{
    qSwap(left->stream, right->stream);
    qSwap(left->track, right->track);
    qSwap(left->next, right->next);
}

static bool initStream(Node *node, const QString &fileName)
{
    xine_close(node->stream);
    if (!xine_open(node->stream, qPrintable(fileName))) {
        printf("Unable to open path '%s'\n", qPrintable(fileName));
        return false;
    }
    Q_ASSERT(node->track != fileName);
    node->track = fileName;
    return true;
}

struct Private
{
    Private() : xine(0), first(0), ao_port(0), event_queue(0),
                status(Backend::Uninitalized), error(XINE_ERROR_NONE),
                progressType(Backend::Seconds), pendingProgress(0)
    {}

    xine_stream_t *stream(const QString &fileName, Node **out = 0)
    {
        if (main.track == fileName) {
            if (out)
                *out = &main;
            return main.stream;
        } else if (!first) {
            if (!::initStream(&main, fileName)) {
                if (out)
                    *out = 0;
                return 0;
            }
            if (out)
                *out = &main;
            return main.stream;
        }
        Node *last = 0;
        Node *node = first;
        Q_ASSERT(first);
        forever {
            if (node->track == fileName) {
                if (out)
                    *out = node;
                return node->stream;
            } else if (node->next) {
{'fraction_non_alphanumeric': 0.13825757575757575, 'fraction_numerical': 0.006944444444444444, 'mean_word_length': 2.0856864654333007, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '334214', 'n_tokens_mistral': 1021, 'n_tokens_neox': 1017, 'n_words': 232}