<commit_before>#define _CRT_SECURE_NO_WARNINGS
#include "uniscanner.h"
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

extern scanner_desc scanner_mem;
extern scanner_desc scanner_file;

scanner_desc *scanners[] = { &scanner_file, &scanner_mem, NULL };

/* See description in uniscanner.h */
void
scanner_init(universal_scanner_options *opts)
{
    memset(opts, 0, sizeof(universal_scanner_options));
    opts->source = IO_SOURCE_FILE;
}

/* See description in uniscanner.h */
void
scanner_deinit(universal_scanner_options *opts)
{
    scanner_close(opts);
}

/* See description in uniscanner.h */
void
scanner_close(universal_scanner_options *opts)
{
    if (opts->input != NULL)
    {
        fclose(opts->input);
        opts->input = NULL;
    }

    if (opts->ptr != NULL)
    {
        free(opts->ptr);
        opts->ptr = NULL;
    }

    opts->pos = 0;
    opts->opaque = NULL;
}

/* See description in uniscanner.h */
static void
scanner_prepare(universal_scanner_options *opts)
{
    if (opts->opaque == NULL)
    {
        scanner_desc **tmp = scanners;

        while (*tmp != NULL && (*tmp)->source != opts->source)
            tmp++;

        if (*tmp == NULL)
        {
            fprintf(stderr, " failed to find a suitable scanner\n");
            exit(1);
        }

        opts->opaque = *tmp;
    }
}

/* See description in uniscanner.h */
int
scanner_getnext(universal_scanner_options *opts)
{
    scanner_prepare(opts);
    return ((scanner_desc *)opts->opaque)->getnext(opts);
}

/* See description in uniscanner.h */
int
scanner_scanf(universal_scanner_options *opts, const char *fmt, ...)
{
    int     ret;
    va_list args;

    va_start(fmt, args);

    scanner_prepare(opts);
    ret = ((scanner_desc *)opts->opaque)->scanf(opts, fmt, args);
    va_end(args);

    return ret;
}<commit_msg>Minor argument placement confusion<commit_after>#define _CRT_SECURE_NO_WARNINGS
#include "uniscanner.h"
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

extern scanner_desc scanner_mem;
extern scanner_desc scanner_file;

scanner_desc *scanners[] = { &scanner_file, &scanner_mem, NULL };

/* See description in uniscanner.h */
void
scanner_init(universal_scanner_options *opts)
{
    memset(opts, 0, sizeof(universal_scanner_options));
    opts->source = IO_SOURCE_FILE;
}

/* See description in uniscanner.h */
void
scanner_deinit(universal_scanner_options *opts)
{
    scanner_close(opts);
}

/* See description in uniscanner.h */
void
scanner_close(universal_scanner_options *opts)
{
    if (opts->input != NULL)
    {
        fclose(opts->input);
        opts->input = NULL;
    }

    if (opts->ptr != NULL)
    {
        free(opts->ptr);
        opts->ptr = NULL;
    }

    opts->pos = 0;
    opts->opaque = NULL;
}

/* See description in uniscanner.h */
static void
scanner_prepare(universal_scanner_options *opts)
{
    if (opts->opaque == NULL)
    {
        scanner_desc **tmp = scanners;

        while (*tmp != NULL && (*tmp)->source != opts->source)
            tmp++;

        if (*tmp == NULL)
        {
            fprintf(stderr, " failed to find a suitable scanner\n");
            exit(1);
        }

        opts->opaque = *tmp;
    }
}

/* See description in uniscanner.h */
int
scanner_getnext(universal_scanner_options *opts)
{
    scanner_prepare(opts);
    return ((scanner_desc *)opts->opaque)->getnext(opts);
}

/* See description in uniscanner.h */
int
scanner_scanf(universal_scanner_options *opts, const char *fmt, ...)
{
    int     ret;
    va_list args;

    va_start(args, fmt);

    scanner_prepare(opts);
    ret = ((scanner_desc *)opts->opaque)->scanf(opts, fmt, args);
    va_end(args);

    return ret;
}
{'fraction_non_alphanumeric': 0.1383118590586379, 'fraction_numerical': 0.0015777018143570865, 'mean_word_length': 3.0815450643776825, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 49, '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': '3467293', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1299, 'n_words': 281}