<commit_before>#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include "assert.h"
#include "kmalloc.h"
#include "ordered_array.h"
#include "term.h"

int8_t std_comparer(void *a, void *b)
{
	return (a < b) ? 1 : 0;
}

Ordered_array create_ordered_array(size_t max_size, Comparer comparer)
{
	Ordered_array result;

	size_t size = max_size * sizeof(void*);
	result.array = (void*)kmalloc(size);
	memset(result.array, 0, size);

	result.size     = 0;
	result.max_size = max_size;
	result.comparer = comparer;

	return result;
}

Ordered_array place_ordered_array(void *addr, size_t max_size,
		Comparer comparer)
{
	Ordered_array result;
	result.array = addr;
	memset(addr, 0, max_size * (sizeof(void*)));<commit_msg>Remove duplicated code in {create,place}_ordered_array()<commit_after>#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include "assert.h"
#include "kmalloc.h"
#include "ordered_array.h"
#include "term.h"

int8_t std_comparer(void *a, void *b)
{
	return (a < b) ? 1 : 0;
}

Ordered_array create_ordered_array(size_t max_size, Comparer comparer)
{
	size_t size = max_size * sizeof(void*);
	return place_ordered_array((void*)kmalloc(size), max_size, comparer);
}

Ordered_array place_ordered_array(void *addr, size_t max_size,
		Comparer comparer)
{
	Ordered_array result;

	result.array = addr;
	memset(addr, 0, max_size * (sizeof(void*)));
{'fraction_non_alphanumeric': 0.1394335511982571, 'fraction_numerical': 0.007262164124909223, 'mean_word_length': 5.788177339901478, 'pattern_counts': {'":': 0, '<': 11, '<?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': '323908', 'n_tokens_mistral': 549, 'n_tokens_neox': 536, 'n_words': 118}