<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "IMF.h"

#define CR                  13
#define LF                  10
#define CS_CR               "\015"
#define CS_LF               "\012"
#define CS_CRLF             CS_CR CS_LF

#ifdef WIN32
#define strncasecmp _strnicmp
#endif

// The return values for Skip and Seek functions are the following:
//
// -1   error
// 0    not enough data or not found
// else the position after the operation
static int SkipWhitespace(char* start, int len)
{
    char *p;
    
    p = start;
    
    if (!p)
        return -1;

    if (len <= 0)
        return -1;

    while (p && *p && *p <= ' ')
    {
        p++;

        if (p - start == len)
            return 0;
    }
    
    if (!*p)
        return -1;
    
    return p - start;   
}

static int SeekWhitespace(char* start, int len)
{
    char *p;
    
    p = start;
    
    if (!p)
        return -1;
    
    if (len <= 0)
        return -1;
    
    while (p && *p && *p != ' ')
    {
        p++;

        if (p - start == len)
            return 0;

    }
    
    if (!*p)
        return -1;
    
    return p - start;
}

static int SkipCrlf(char* start, int len)
{
    char*   p;
    
    p = start;
    
    if (!p)
        return -1;
    
    if (len < 0)
        return -1;
        
    if (len < 2)
        return 0;
    
    while (*p && (*p == CS_CR[0] || *p == CS_LF[0]))
    {
        p++;

        if (p - start == len)
            return 0;

    }
    
    if (!*p)
        return -1;
    
    return p - start;
}

static int SeekCrlf(char* start, int len)
{
    char*   p;
    
    p = start;
    
    if (!p)
        return -1;
    
    if (len < 0)
        return -1;
    
    if (len < 2)
        return 0;
    
    while (*p && (p[0] != CS_CR[0] && p[1] != CS_LF[0]))
    {
        p++;

        if (p - start == len)
            return 0;
    }
    
    if (!*p)
        return -1;
    
    return p - start;   
}

static int SeekChar(char* start, int len, char c)
{
    char*   p;
    
    p = start;
    
    if (!p)
        return -1;
    
    if (len < 0)
        return -1;
    
    if (len < 1)
        return 0;
    
    while (*p && *p != c)
    {
        p++;
<commit_msg>Fixed uninitialized bug in IMF parser.<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "IMF.h"

#define CR                  13
#define LF                  10
#define CS_CR               "\015"
#define CS_LF               "\012"
#define CS_CRLF             CS_CR CS_LF

#ifdef WIN32
#define strncasecmp _strnicmp
#endif

// The return values for Skip and Seek functions are the following:
//
// -1   error
// 0    not enough data or not found
// else the position after the operation
static int SkipWhitespace(char* start, int len)
{
    char *p;
    
    p = start;
    
    if (!p)
        return -1;

    if (len <= 0)
        return -1;

    while (p && *p && *p <= ' ')
    {
        p++;

        if (p - start == len)
            return 0;
    }
    
    if (!*p)
        return -1;
    
    return p - start;   
}

static int SeekWhitespace(char* start, int len)
{
    char *p;
    
    p = start;
    
    if (!p)
        return -1;
    
    if (len <= 0)
        return -1;
    
    while (p && *p && *p != ' ')
    {
        p++;

        if (p - start == len)
            return 0;

    }
    
    if (!*p)
        return -1;
    
    return p - start;
}

static int SkipCrlf(char* start, int len)
{
    char*   p;
    
    p = start;
    
    if (!p)
        return -1;
    
    if (len < 0)
        return -1;
        
    if (len < 2)
        return 0;
    
    while (*p && (*p == CS_CR[0] || *p == CS_LF[0]))
    {
        p++;

        if (p - start == len)
            return 0;

    }
    
    if (!*p)
        return -1;
    
    return p - start;
}

static int SeekCrlf(char* start, int len)
{
    char*   p;
    
    p = start;
    
    if (!p)
        return -1;
    
    if (len < 0)
        return -1;
    
    if (len < 2)
        return 0;
    
    while (*p && (p[0] != CS_CR[0] && p[1] != CS_LF[0]))
    {
        p++;

        if (p - start == len - 1)
            return 0;
    }
    
    if (!*p)
        return -1;
    
    return p - start;   
}

static int SeekChar(char* start, int len, char c)
{
    char*   p;
    
    p = start;
    
    if (!p)
        return -1;
    
    if (len < 0)
        return -1;
    
    if (len < 1)
        return 0;
    
    while (*p && *p != c)
    {
        p++;

{'fraction_non_alphanumeric': 0.13845129798091857, 'fraction_numerical': 0.021965830929664965, 'mean_word_length': 1.1425855513307985, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 9, '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': '2618300', 'n_tokens_mistral': 1741, 'n_tokens_neox': 1657, 'n_words': 504}