<commit_before>#include "config.h"

#include "ref.h"

class null_ref* null_ref_ptr;
class null_ref& null(*null_ref_ptr);
<commit_msg>Fancy allocation of a null_ref at address 0 to fool compiler-analyzers.<commit_after>#include "config.h"
#include "ref.h"
#include <stddef.h>

// dummy allocation arena
class null_arena {
public:
    void* allocate(size_t);
};

// place anything at NULL
void* null_arena::allocate(size_t) {
    return (void *) 0;
}

// arena for null_ref
null_arena a_null_arena;

// placement new for null_arena
void* operator new(size_t size, null_arena& arena) {
    return arena.allocate(size);
}

// an inaccessible class
class null_ref {
public:
    // pointer to null_ref
    static null_ref* a_null_ptr;
private:
    // cannot instantiate
    null_ref() { }
    // cannot copy
    null_ref(const null_ref&);
};

// allocate a null_ref at NULL
null_ref* null_ref::a_null_ptr(new (a_null_arena) null_ref);

// null references a null_ref at NULL
null_ref& null(*null_ref::a_null_ptr);

// reference count became zero
{'fraction_non_alphanumeric': 0.11368015414258188, 'fraction_numerical': 0.0019267822736030828, 'mean_word_length': 4.221105527638191, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '6555175', 'n_tokens_mistral': 374, 'n_tokens_neox': 366, 'n_words': 103}