<commit_before>#include "stream_of_byte_map.h"

typedef struct mapped_byte_stream {
	void(*next)(stream_of_byte *self, byte v);
	void(*error)(stream_of_byte *self, byte e);
	void(*complete)(stream_of_byte *self);
	varray *listeners;
	byte(*map)(byte value);
} mapped_stream_of_byte;

void mapped_stream_of_byte_next(stream_of_byte *stream, byte v) {
	mapped_stream_of_byte* mapped_stream = (mapped_stream_of_byte*)stream;
	byte mapped = mapped_stream->map(v);
	varray *array = stream->listeners;
	int length = varray_length(array);
	for (int i = 0; i < length; i++) {
		stream_of_byte *listener = ((stream_of_byte *)varray_get(array, i));
		listener->next(listener, mapped);
	}
};

mapped_stream_of_byte* mapped_stream_of_byte_create(mapper_function_from_byte_to_byte map) {
	mapped_stream_of_byte* stream = xmalloc(sizeof(mapped_stream_of_byte));
	stream_of_byte_init(stream);
	stream->map = map;
	stream->next = mapped_stream_of_byte_next;
	return stream;
}

stream_of_byte* stream_of_byte_map(stream_of_byte *stream, mapper_function_from_byte_to_byte mapper) {
	mapped_stream_of_byte* mapped_stream = mapped_stream_of_byte_create(mapper);
	stream_of_byte* mapped_listener = (stream_of_byte*)mapped_stream;
	return (stream_of_byte*)stream_add_listener(stream, mapped_listener);
}
<commit_msg>Rename struct to follow convention<commit_after>#include "stream_of_byte_map.h"

typedef struct mapped_stream_of_byte_t {
	void(*next)(stream_of_byte *self, byte v);
	void(*error)(stream_of_byte *self, byte e);
	void(*complete)(stream_of_byte *self);
	varray *listeners;
	byte(*map)(byte value);
} mapped_stream_of_byte;

void mapped_stream_of_byte_next(stream_of_byte *stream, byte v) {
	mapped_stream_of_byte* mapped_stream = (mapped_stream_of_byte*)stream;
	byte mapped = mapped_stream->map(v);
	varray *array = stream->listeners;
	int length = varray_length(array);
	for (int i = 0; i < length; i++) {
		stream_of_byte *listener = ((stream_of_byte *)varray_get(array, i));
		listener->next(listener, mapped);
	}
};

mapped_stream_of_byte* mapped_stream_of_byte_create(mapper_function_from_byte_to_byte map) {
	mapped_stream_of_byte* stream = xmalloc(sizeof(mapped_stream_of_byte));
	stream_of_byte_init(stream);
	stream->map = map;
	stream->next = mapped_stream_of_byte_next;
	return stream;
}

stream_of_byte* stream_of_byte_map(stream_of_byte *stream, mapper_function_from_byte_to_byte mapper) {
	mapped_stream_of_byte* mapped_stream = mapped_stream_of_byte_create(mapper);
	stream_of_byte* mapped_listener = (stream_of_byte*)mapped_stream;
	return (stream_of_byte*)stream_add_listener(stream, mapped_listener);
}

{'fraction_non_alphanumeric': 0.11094108645753634, 'fraction_numerical': 0.0007651109410864575, 'mean_word_length': 8.649446494464945, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3366618', 'n_tokens_mistral': 970, 'n_tokens_neox': 959, 'n_words': 160}