<commit_before>#include "samples.h"
#include "free.h"
#include "str.h"

struct bgen_samples
{
    struct bgen_str const** sample_ids;
    uint32_t                nsamples;
};

void bgen_samples_free(struct bgen_samples const* samples)
{
    for (uint32_t i = 0; i < samples->nsamples; ++i) {
        if (samples->sample_ids[i] != NULL)
            bgen_str_free(samples->sample_ids[i]);
    }

    free_c(samples->sample_ids);
    free_c(samples);
}

struct bgen_str const* bgen_samples_get(struct bgen_samples const* samples,
                                        uint32_t const             index)
{
    return samples->sample_ids[index];
}

struct bgen_samples* bgen_samples_create(uint32_t const nsamples)
{
    struct bgen_samples* samples = malloc(sizeof(struct bgen_samples));
    samples->sample_ids = malloc(sizeof(struct bgen_str*) * nsamples);
    samples->nsamples = nsamples;
    for (uint32_t i = 0; i < nsamples; ++i)
        samples->sample_ids[i] = NULL;
    return samples;
}

void bgen_samples_set(struct bgen_samples const* samples, uint32_t const index,
                      struct bgen_str const* sample_id)
{
    samples->sample_ids[index] = sample_id;
}
<commit_msg>samples module seems fine<commit_after>#include "samples.h"
#include "free.h"
#include "str.h"

struct bgen_samples
{
    struct bgen_str const** sample_ids;
    uint32_t                nsamples;
};

void bgen_samples_free(struct bgen_samples const* samples)
{
    for (uint32_t i = 0; i < samples->nsamples; ++i) {
        if (samples->sample_ids[i])
            bgen_str_free(samples->sample_ids[i]);
    }

    free_c(samples->sample_ids);
    free_c(samples);
}

struct bgen_str const* bgen_samples_get(struct bgen_samples const* samples,
                                        uint32_t const             index)
{
    return samples->sample_ids[index];
}

struct bgen_samples* bgen_samples_create(uint32_t const nsamples)
{
    struct bgen_samples* samples = malloc(sizeof(struct bgen_samples));
    samples->sample_ids = malloc(sizeof(struct bgen_str*) * nsamples);
    samples->nsamples = nsamples;
    for (uint32_t i = 0; i < nsamples; ++i)
        samples->sample_ids[i] = NULL;
    return samples;
}

void bgen_samples_set(struct bgen_samples const* samples, uint32_t const index,
                      struct bgen_str const* sample_id)
{
    samples->sample_ids[index] = sample_id;
}

{'fraction_non_alphanumeric': 0.10720268006700168, 'fraction_numerical': 0.011725293132328308, 'mean_word_length': 3.035472972972973, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6666592', 'n_tokens_mistral': 809, 'n_tokens_neox': 782, 'n_words': 172}