<commit_before>#include "hash_fixed.h"
#include "const_mem_pool.h"

struct hash *hash_create_fixed( size_t size
                              , void *mem
                              , size_t keysize
                              , size_t valsize
                              , size_t nbuckets
                              , uint32_t (*hashfun)(void *)
                              , bool     (*keycmp)(void *, void *)
                              , void     (*keycopy)(void *, void *)
                              , void     (*valcopy)(void *, void *) ) {


    void *pool = const_mem_pool_create(size, mem);

    if( !pool ) {
        return 0;
    }

    return hash_create( hash_size
                      , const_mem_pool_alloc(pool, hash_size)
                      , keysize
                      , valsize
                      , nbuckets
                      , hashfun
                      , keycmp
                      , keycopy
                      , valcopy
                      , pool
                      , const_mem_pool_alloc
                      , const_mem_pool_dealloc );

}

<commit_msg>hash_fixed, no-rehash flag (fill_rate = 0)<commit_after>#include "hash_fixed.h"
#include "const_mem_pool.h"

struct hash *hash_create_fixed( size_t size
                              , void *mem
                              , size_t keysize
                              , size_t valsize
                              , size_t nbuckets
                              , uint32_t (*hashfun)(void *)
                              , bool     (*keycmp)(void *, void *)
                              , void     (*keycopy)(void *, void *)
                              , void     (*valcopy)(void *, void *) ) {


    void *pool = const_mem_pool_create(size, mem);

    if( !pool ) {
        return 0;
    }

    struct hash *h = hash_create( hash_size
                                , const_mem_pool_alloc(pool, hash_size)
                                , keysize
                                , valsize
                                , nbuckets
                                , hashfun
                                , keycmp
                                , keycopy
                                , valcopy
                                , pool
                                , const_mem_pool_alloc
                                , const_mem_pool_dealloc );

    // never rehash fixed hash
    hash_set_rehash_values(h, 0, 0);
}


{'fraction_non_alphanumeric': 0.07407407407407407, 'fraction_numerical': 0.003663003663003663, 'mean_word_length': 0.8046989720998532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5847289', 'n_tokens_mistral': 631, 'n_tokens_neox': 582, 'n_words': 115}