<commit_before>#include "gjalloc.h"
#include <stdlib.h>
#include <stdio.h>

#define N 10
struct ba_local a;

struct foo {
    size_t n;
    uint64_t padding[5];
};

struct foo ** list;

void relocate_simple(void * start, void * stop, ptrdiff_t diff) {
    struct foo * n = (struct foo*)start;
    
    while (n < (struct foo*)stop) {
	list[n->n] += diff;
	n++;
    }
}

void callback(struct foo * start, struct foo * stop, void * data) {
    while (start < stop) {
	fprintf(stderr, "is there: %llu\n", (unsigned long long)start->n);
	start++;
    }
}


int main() {
    size_t i;

    list = (struct foo**)malloc(N*sizeof(struct foo));
    ba_init_local(&a, sizeof(struct foo), 16, 512, relocate_simple, NULL);

    for (i = 0; i < N; i++) {
	list[i] = ba_lalloc(&a);
	list[i]->n = i;
    }

    ba_lfree(&a, list[5]);
    ba_lfree(&a, list[7]);
    ba_lfree(&a, list[2]);
    ba_walk_local(&a, callback, NULL);


    return 0;
}
<commit_msg>cleanup<commit_after>#include "gjalloc.h"
#include <stdlib.h>
#include <stdio.h>

#define N 10
struct ba_local a;

struct foo {
    size_t n;
    uint64_t padding[5];
};

struct foo ** list;

void relocate_simple(void * start, void * stop, ptrdiff_t diff) {
    struct foo * n = (struct foo*)start;
    
    while (n < (struct foo*)stop) {
	list[n->n] += diff;
	n++;
    }
}

void callback(struct foo * start, struct foo * stop, void * data) {
    while (start < stop) {
	fprintf(stderr, "is there: %llu\n", (unsigned long long)start->n);
	start++;
    }
}


int main() {
    size_t i;

    list = (struct foo**)malloc(N*sizeof(struct foo));
    ba_init_local(&a, sizeof(struct foo), 16, 512, relocate_simple, NULL);

    for (i = 0; i < N; i++) {
	list[i] = ba_lalloc(&a);
	list[i]->n = i;
    }

    ba_lfree(&a, list[5]);
    ba_lfree(&a, list[7]);
    ba_lfree(&a, list[2]);
    ba_walk_local(&a, callback, NULL);

    ba_ldestroy(&a);
    free(list);

    return 0;
}

{'fraction_non_alphanumeric': 0.17911227154046996, 'fraction_numerical': 0.015665796344647518, 'mean_word_length': 3.1742919389978215, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '2528623', 'n_tokens_mistral': 793, 'n_tokens_neox': 758, 'n_words': 194}