VALUE allocations_to_hash()

in ext/liballocations/liballocations.c [88:106]


VALUE allocations_to_hash(VALUE self) {
    AllocationState *state = allocation_state_get_struct(state_const);

    st_table *local_counts;
    VALUE hash;

    if ( !state->object_counts ) {
        return rb_hash_new();
    }

    local_counts = allocation_state_copy_table(state);
    hash = rb_hash_new();

    st_foreach(local_counts, each_count, (st_data_t) hash);

    st_free_table(local_counts);

    return hash;
}