<commit_before>#include "config.h"
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>


void configInit(struct config *cfg)
{
    assert(cfg != NULL);

    cfg->end = NULL;
    cfg->head = NULL;
}


bool configPush(struct config *cfg, char *name)
{
    assert(cfg != NULL);
    assert(name != NULL);

    struct section *sec = malloc(sizeof *sec);

    if (!sec) {
        return false;
    }

    sec->name = (char *)malloc(strlen(name) + 1);

    if (!sec->name) {
        return false;
    }

    sec->values = calloc(10, sizeof(char *));

    if (!sec->values) {
        return false;
    }

    strcpy(sec->name, name);

    if (!cfg->head) {
        cfg->end = sec;
        cfg->head = sec;
        sec->prev = NULL;
        sec->next = NULL;
    } else {
        sec->next = NULL;
        sec->prev = cfg->end;
        cfg->end->next = sec;
        cfg->end = sec;
    }

    return true;
}


bool configAddValue(struct section *sec, char *value, unsigned int index, unsigned int *memory)
{
    assert(sec != NULL);
    assert(value != NULL);

    if (index >= *memory) {
        sec->values = (char**)realloc(sec->values, (*memory + *memory) * sizeof(char *));<commit_msg>func configAddValue, sec->values conditional<commit_after>#include "config.h"
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>


void configInit(struct config *cfg)
{
    assert(cfg != NULL);

    cfg->end = NULL;
    cfg->head = NULL;
}


bool configPush(struct config *cfg, char *name)
{
    assert(cfg != NULL);
    assert(name != NULL);

    struct section *sec = malloc(sizeof *sec);

    if (!sec) {
        return false;
    }

    sec->name = (char *)malloc(strlen(name) + 1);

    if (!sec->name) {
        return false;
    }

    sec->values = calloc(10, sizeof(char *));

    if (!sec->values) {
        return false;
    }

    strcpy(sec->name, name);

    if (!cfg->head) {
        cfg->end = sec;
        cfg->head = sec;
        sec->prev = NULL;
        sec->next = NULL;
    } else {
        sec->next = NULL;
        sec->prev = cfg->end;
        cfg->end->next = sec;
        cfg->end = sec;
    }

    return true;
}


bool configAddValue(struct section *sec, char *value, unsigned int index, unsigned int *memory)
{
    assert(sec != NULL);
    assert(value != NULL);

    if (index >= *memory) {
        sec->values = (char**)realloc(sec->values, (*memory + *memory) * sizeof(char *));

        if (!sec->values) {
            return false;
        }

{'fraction_non_alphanumeric': 0.17007327419976861, 'fraction_numerical': 0.0023139220979560356, 'mean_word_length': 2.2918781725888326, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 59, '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': '7632909', 'n_tokens_mistral': 903, 'n_tokens_neox': 862, 'n_words': 217}