Ruby  2.4.2p198(2017-09-14revision59899)
Data Structures | Macros | Typedefs | Functions | Variables
st.c File Reference
#include "internal.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
Include dependency graph for st.c:

Go to the source code of this file.

Data Structures

struct  st_table_entry
 
struct  st_features
 

Macros

#define PREFETCH(addr, write_p)
 
#define EXPECT(expr, val)   (expr)
 
#define ATTRIBUTE_UNUSED
 
#define st_assert(cond)   ((void)(0 && (cond)))
 
#define type_numhash   st_hashtype_num
 
#define ST_INIT_VAL   0xafafafafafafafaf
 
#define ST_INIT_VAL_BYTE   0xafa
 
#define malloc   ruby_xmalloc
 
#define calloc   ruby_xcalloc
 
#define realloc   ruby_xrealloc
 
#define free   ruby_xfree
 
#define EQUAL(tab, x, y)   ((x) == (y) || (*(tab)->type->compare)((x),(y)) == 0)
 
#define PTR_EQUAL(tab, ptr, hash_val, key)   ((ptr)->hash == (hash_val) && EQUAL((tab), (key), (ptr)->key))
 
#define MAX_POWER2   30
 
#define RESERVED_HASH_VAL   (~(st_hash_t) 0)
 
#define RESERVED_HASH_SUBSTITUTION_VAL   ((st_hash_t) 0)
 
#define MINIMAL_POWER2   2
 
#define MAX_POWER2_FOR_TABLES_WITHOUT_BINS   4
 
#define EMPTY_BIN   0
 
#define DELETED_BIN   1
 
#define ENTRY_BASE   2
 
#define MARK_BIN_EMPTY(tab, i)   (set_bin((tab)->bins, get_size_ind(tab), i, EMPTY_BIN))
 
#define UNDEFINED_ENTRY_IND   (~(st_index_t) 0)
 
#define UNDEFINED_BIN_IND   (~(st_index_t) 0)
 
#define MARK_BIN_DELETED(tab, i)
 
#define EMPTY_BIN_P(b)   ((b) == EMPTY_BIN)
 
#define DELETED_BIN_P(b)   ((b) == DELETED_BIN)
 
#define EMPTY_OR_DELETED_BIN_P(b)   ((b) <= DELETED_BIN)
 
#define IND_EMPTY_BIN_P(tab, i)   (EMPTY_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))
 
#define IND_DELETED_BIN_P(tab, i)   (DELETED_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))
 
#define IND_EMPTY_OR_DELETED_BIN_P(tab, i)   (EMPTY_OR_DELETED_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))
 
#define MARK_ENTRY_DELETED(e_ptr)   ((e_ptr)->hash = RESERVED_HASH_VAL)
 
#define DELETED_ENTRY_P(e_ptr)   ((e_ptr)->hash == RESERVED_HASH_VAL)
 
#define COLLISION
 
#define FOUND_BIN
 
#define REBUILD_THRESHOLD   4
 
#define FNV1_32A_INIT   0x811c9dc5
 
#define FNV_32_PRIME   0x01000193
 
#define BIG_CONSTANT(x, y)   ((st_index_t)(x)<<32|(st_index_t)(y))
 
#define ROTL(x, n)   ((x)<<(n)|(x)>>(SIZEOF_ST_INDEX_T*CHAR_BIT-(n)))
 
#define C1   (st_index_t)0xcc9e2d51
 
#define C2   (st_index_t)0x1b873593
 
#define r1   (17)
 
#define r2   (11)
 
#define r1   (16)
 
#define r2   (13)
 
#define r3   (16)
 
#define data_at(n)   (st_index_t)((unsigned char)data[(n)])
 
#define UNALIGNED_ADD_4   UNALIGNED_ADD(2); UNALIGNED_ADD(1); UNALIGNED_ADD(0)
 
#define UNALIGNED_ADD_ALL   UNALIGNED_ADD_4
 
#define UNALIGNED_ADD(n)
 
#define UNALIGNED_ADD(n)
 
#define SKIP_TAIL   1
 
#define UNALIGNED_ADD(n)
 

Typedefs

typedef st_index_t st_hash_t
 

Functions

static st_index_t strhash (st_data_t)
 
static st_index_t strcasehash (st_data_t)
 
static st_hash_t do_hash (st_data_t key, st_table *tab)
 
static int get_power2 (st_index_t size)
 
static st_index_t get_bin (st_index_t *bins, int s, st_index_t n)
 
static void set_bin (st_index_t *bins, int s, st_index_t n, st_index_t v)
 
static unsigned int get_size_ind (const st_table *tab)
 
static st_index_t get_bins_num (const st_table *tab)
 
static st_index_t bins_mask (const st_table *tab)
 
static st_index_t hash_bin (st_hash_t hash_value, st_table *tab)
 
static st_index_t get_allocated_entries (const st_table *tab)
 
static st_index_t bins_size (const st_table *tab)
 
static void initialize_bins (st_table *tab)
 
static void make_tab_empty (st_table *tab)
 
st_tablest_init_table_with_size (const struct st_hash_type *type, st_index_t size)
 
st_tablest_init_table (const struct st_hash_type *type)
 
st_tablest_init_numtable (void)
 
st_tablest_init_numtable_with_size (st_index_t size)
 
st_tablest_init_strtable (void)
 
st_tablest_init_strtable_with_size (st_index_t size)
 
st_tablest_init_strcasetable (void)
 
st_tablest_init_strcasetable_with_size (st_index_t size)
 
void st_clear (st_table *tab)
 
void st_free_table (st_table *tab)
 
size_t st_memsize (const st_table *tab)
 
static st_index_t find_table_entry_ind (st_table *tab, st_hash_t hash_value, st_data_t key)
 
static st_index_t find_table_bin_ind (st_table *tab, st_hash_t hash_value, st_data_t key)
 
static st_index_t find_table_bin_ind_direct (st_table *table, st_hash_t hash_value, st_data_t key)
 
static st_index_t find_table_bin_ptr_and_reserve (st_table *tab, st_hash_t *hash_value, st_data_t key, st_index_t *bin_ind)
 
static void rebuild_table (st_table *tab)
 
static st_index_t secondary_hash (st_index_t ind, st_table *tab, st_index_t *perterb)
 
static st_index_t find_entry (st_table *tab, st_hash_t hash_value, st_data_t key)
 
int st_lookup (st_table *tab, st_data_t key, st_data_t *value)
 
int st_get_key (st_table *tab, st_data_t key, st_data_t *result)
 
static void rebuild_table_if_necessary (st_table *tab)
 
int st_insert (st_table *tab, st_data_t key, st_data_t value)
 
static void st_add_direct_with_hash (st_table *tab, st_data_t key, st_data_t value, st_hash_t hash)
 
void st_add_direct (st_table *tab, st_data_t key, st_data_t value)
 
int st_insert2 (st_table *tab, st_data_t key, st_data_t value, st_data_t(*func)(st_data_t))
 
st_tablest_copy (st_table *old_tab)
 
static void update_range_for_deleted (st_table *tab, st_index_t n)
 
static int st_general_delete (st_table *tab, st_data_t *key, st_data_t *value)
 
int st_delete (st_table *tab, st_data_t *key, st_data_t *value)
 
int st_delete_safe (st_table *tab, st_data_t *key, st_data_t *value, st_data_t never ATTRIBUTE_UNUSED)
 
int st_shift (st_table *tab, st_data_t *key, st_data_t *value)
 
void st_cleanup_safe (st_table *tab ATTRIBUTE_UNUSED, st_data_t never ATTRIBUTE_UNUSED)
 
int st_update (st_table *tab, st_data_t key, st_update_callback_func *func, st_data_t arg)
 
static int st_general_foreach (st_table *tab, int(*func)(ANYARGS), st_data_t arg, int check_p)
 
int st_foreach (st_table *tab, int(*func)(ANYARGS), st_data_t arg)
 
int st_foreach_check (st_table *tab, int(*func)(ANYARGS), st_data_t arg, st_data_t never ATTRIBUTE_UNUSED)
 
static st_index_t st_general_keys (st_table *tab, st_data_t *keys, st_index_t size)
 
st_index_t st_keys (st_table *tab, st_data_t *keys, st_index_t size)
 
st_index_t st_keys_check (st_table *tab, st_data_t *keys, st_index_t size, st_data_t never ATTRIBUTE_UNUSED)
 
static st_index_t st_general_values (st_table *tab, st_data_t *values, st_index_t size)
 
st_index_t st_values (st_table *tab, st_data_t *values, st_index_t size)
 
st_index_t st_values_check (st_table *tab, st_data_t *values, st_index_t size, st_data_t never ATTRIBUTE_UNUSED)
 
static st_index_t murmur_step (st_index_t h, st_index_t k)
 
static st_index_t murmur_finish (st_index_t h)
 
st_index_t st_hash (const void *ptr, size_t len, st_index_t h)
 
st_index_t st_hash_uint32 (st_index_t h, uint32_t i)
 
st_index_t st_hash_uint (st_index_t h, st_index_t i)
 
st_index_t st_hash_end (st_index_t h)
 
st_index_t st_hash_start (st_index_t h)
 
int st_locale_insensitive_strcasecmp (const char *s1, const char *s2)
 
int st_locale_insensitive_strncasecmp (const char *s1, const char *s2, size_t n)
 
 PUREFUNC (static st_index_t strcasehash(st_data_t))
 
int st_numcmp (st_data_t x, st_data_t y)
 
st_index_t st_numhash (st_data_t n)
 

Variables

const struct st_hash_type st_hashtype_num
 
static const struct st_hash_type type_strhash
 
static const struct st_hash_type type_strcasehash
 
static const struct st_features features []
 

Macro Definition Documentation

◆ ATTRIBUTE_UNUSED

#define ATTRIBUTE_UNUSED

Definition at line 119 of file st.c.

◆ BIG_CONSTANT

#define BIG_CONSTANT (   x,
 
)    ((st_index_t)(x)<<32|(st_index_t)(y))

Definition at line 1635 of file st.c.

Referenced by murmur_finish().

◆ C1

#define C1   (st_index_t)0xcc9e2d51

Definition at line 1639 of file st.c.

Referenced by murmur_step().

◆ C2

#define C2   (st_index_t)0x1b873593

Definition at line 1640 of file st.c.

Referenced by murmur_step(), and st_hash().

◆ calloc

#define calloc   ruby_xcalloc

Definition at line 168 of file st.c.

◆ COLLISION

#define COLLISION

◆ data_at

#define data_at (   n)    (st_index_t)((unsigned char)data[(n)])

Referenced by st_hash().

◆ DELETED_BIN

#define DELETED_BIN   1

Definition at line 370 of file st.c.

◆ DELETED_BIN_P

#define DELETED_BIN_P (   b)    ((b) == DELETED_BIN)

Definition at line 396 of file st.c.

Referenced by find_table_bin_ptr_and_reserve().

◆ DELETED_ENTRY_P

#define DELETED_ENTRY_P (   e_ptr)    ((e_ptr)->hash == RESERVED_HASH_VAL)

◆ EMPTY_BIN

#define EMPTY_BIN   0

Definition at line 369 of file st.c.

◆ EMPTY_BIN_P

#define EMPTY_BIN_P (   b)    ((b) == EMPTY_BIN)

Definition at line 395 of file st.c.

Referenced by find_table_bin_ind(), find_table_bin_ptr_and_reserve(), and find_table_entry_ind().

◆ EMPTY_OR_DELETED_BIN_P

#define EMPTY_OR_DELETED_BIN_P (   b)    ((b) <= DELETED_BIN)

Definition at line 397 of file st.c.

Referenced by find_table_bin_ind(), find_table_bin_ind_direct(), and find_table_entry_ind().

◆ ENTRY_BASE

#define ENTRY_BASE   2

◆ EQUAL

#define EQUAL (   tab,
  x,
 
)    ((x) == (y) || (*(tab)->type->compare)((x),(y)) == 0)

Definition at line 173 of file st.c.

◆ EXPECT

#define EXPECT (   expr,
  val 
)    (expr)

Definition at line 118 of file st.c.

Referenced by rebuild_table(), and st_general_foreach().

◆ FNV1_32A_INIT

#define FNV1_32A_INIT   0x811c9dc5

Definition at line 1613 of file st.c.

Referenced by strcasehash(), and strhash().

◆ FNV_32_PRIME

#define FNV_32_PRIME   0x01000193

Definition at line 1618 of file st.c.

Referenced by strcasehash().

◆ FOUND_BIN

#define FOUND_BIN

◆ free

#define free   ruby_xfree

Definition at line 170 of file st.c.

Referenced by rebuild_table(), and st_free_table().

◆ IND_DELETED_BIN_P

#define IND_DELETED_BIN_P (   tab,
 
)    (DELETED_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))

Definition at line 402 of file st.c.

Referenced by make_tab_empty().

◆ IND_EMPTY_BIN_P

#define IND_EMPTY_BIN_P (   tab,
 
)    (EMPTY_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))

Definition at line 401 of file st.c.

Referenced by make_tab_empty(), and rebuild_table().

◆ IND_EMPTY_OR_DELETED_BIN_P

#define IND_EMPTY_OR_DELETED_BIN_P (   tab,
 
)    (EMPTY_OR_DELETED_BIN_P(get_bin((tab)->bins, get_size_ind(tab), i)))

Definition at line 403 of file st.c.

◆ malloc

#define malloc   ruby_xmalloc

Definition at line 167 of file st.c.

Referenced by st_copy(), and st_init_table_with_size().

◆ MARK_BIN_DELETED

#define MARK_BIN_DELETED (   tab,
 
)
Value:
do { \
st_assert(i != UNDEFINED_BIN_IND); \
st_assert(! IND_EMPTY_OR_DELETED_BIN_P(tab, i)); \
set_bin((tab)->bins, get_size_ind(tab), i, DELETED_BIN); \
} while (0)
#define DELETED_BIN
Definition: st.c:370
#define IND_EMPTY_OR_DELETED_BIN_P(tab, i)
Definition: st.c:403
static unsigned int get_size_ind(const st_table *tab)
Definition: st.c:412
#define UNDEFINED_BIN_IND
Definition: st.c:381

Definition at line 386 of file st.c.

Referenced by st_general_delete(), st_general_foreach(), st_shift(), and st_update().

◆ MARK_BIN_EMPTY

#define MARK_BIN_EMPTY (   tab,
 
)    (set_bin((tab)->bins, get_size_ind(tab), i, EMPTY_BIN))

Definition at line 376 of file st.c.

Referenced by find_table_bin_ptr_and_reserve().

◆ MARK_ENTRY_DELETED

#define MARK_ENTRY_DELETED (   e_ptr)    ((e_ptr)->hash = RESERVED_HASH_VAL)

Definition at line 407 of file st.c.

Referenced by st_general_delete(), st_general_foreach(), st_shift(), and st_update().

◆ MAX_POWER2

#define MAX_POWER2   30

Definition at line 262 of file st.c.

Referenced by get_power2().

◆ MAX_POWER2_FOR_TABLES_WITHOUT_BINS

#define MAX_POWER2_FOR_TABLES_WITHOUT_BINS   4

Definition at line 324 of file st.c.

Referenced by make_tab_empty(), and st_init_table_with_size().

◆ MINIMAL_POWER2

#define MINIMAL_POWER2   2

Definition at line 316 of file st.c.

Referenced by get_power2(), make_tab_empty(), and rebuild_table().

◆ PREFETCH

#define PREFETCH (   addr,
  write_p 
)

Definition at line 117 of file st.c.

Referenced by rebuild_table().

◆ PTR_EQUAL

#define PTR_EQUAL (   tab,
  ptr,
  hash_val,
  key 
)    ((ptr)->hash == (hash_val) && EQUAL((tab), (key), (ptr)->key))

◆ r1 [1/2]

#define r1   (17)

◆ r1 [2/2]

#define r1   (16)

◆ r2 [1/2]

#define r2   (11)

◆ r2 [2/2]

#define r2   (13)

◆ r3

#define r3   (16)

◆ realloc

#define realloc   ruby_xrealloc

Definition at line 169 of file st.c.

◆ REBUILD_THRESHOLD

#define REBUILD_THRESHOLD   4

Definition at line 721 of file st.c.

Referenced by rebuild_table().

◆ RESERVED_HASH_SUBSTITUTION_VAL

#define RESERVED_HASH_SUBSTITUTION_VAL   ((st_hash_t) 0)

Definition at line 302 of file st.c.

Referenced by do_hash().

◆ RESERVED_HASH_VAL

#define RESERVED_HASH_VAL   (~(st_hash_t) 0)

Definition at line 301 of file st.c.

Referenced by do_hash().

◆ ROTL

#define ROTL (   x,
 
)    ((x)<<(n)|(x)>>(SIZEOF_ST_INDEX_T*CHAR_BIT-(n)))

Definition at line 1636 of file st.c.

Referenced by murmur_step(), and st_hash().

◆ SKIP_TAIL

#define SKIP_TAIL   1

◆ st_assert

#define st_assert (   cond)    ((void)(0 && (cond)))

◆ ST_INIT_VAL

#define ST_INIT_VAL   0xafafafafafafafaf

Definition at line 159 of file st.c.

Referenced by make_tab_empty().

◆ ST_INIT_VAL_BYTE

#define ST_INIT_VAL_BYTE   0xafa

Definition at line 160 of file st.c.

Referenced by st_init_table_with_size().

◆ type_numhash

#define type_numhash   st_hashtype_num

Definition at line 137 of file st.c.

Referenced by st_init_numtable(), st_init_numtable_with_size(), and st_memsize().

◆ UNALIGNED_ADD [1/3]

#define UNALIGNED_ADD (   n)
Value:
case SIZEOF_ST_INDEX_T - (n) - 1: \
t |= data_at(n) << CHAR_BIT*(n)
#define SIZEOF_ST_INDEX_T
Definition: st.h:59
#define CHAR_BIT
Definition: ruby.h:196
#define data_at(n)

◆ UNALIGNED_ADD [2/3]

#define UNALIGNED_ADD (   n)
Value:
case (n) + 1: \
d |= data_at(n) << CHAR_BIT*(n)
#define CHAR_BIT
Definition: ruby.h:196
#define data_at(n)

◆ UNALIGNED_ADD [3/3]

#define UNALIGNED_ADD (   n)
Value:
case (n) + 1: \
t |= data_at(n) << CHAR_BIT*(n)
#define CHAR_BIT
Definition: ruby.h:196
#define data_at(n)

◆ UNALIGNED_ADD_4

#define UNALIGNED_ADD_4   UNALIGNED_ADD(2); UNALIGNED_ADD(1); UNALIGNED_ADD(0)

◆ UNALIGNED_ADD_ALL

#define UNALIGNED_ADD_ALL   UNALIGNED_ADD_4

Referenced by st_hash().

◆ UNDEFINED_BIN_IND

#define UNDEFINED_BIN_IND   (~(st_index_t) 0)

◆ UNDEFINED_ENTRY_IND

#define UNDEFINED_ENTRY_IND   (~(st_index_t) 0)

Typedef Documentation

◆ st_hash_t

Definition at line 129 of file st.c.

Function Documentation

◆ bins_mask()

static st_index_t bins_mask ( const st_table tab)
inlinestatic

Definition at line 426 of file st.c.

References get_bins_num().

Referenced by hash_bin().

◆ bins_size()

static st_index_t bins_size ( const st_table tab)
inlinestatic

Definition at line 448 of file st.c.

References st_features::bins_words, and st_table::entry_power.

Referenced by initialize_bins(), st_copy(), st_init_table_with_size(), and st_memsize().

◆ do_hash()

static st_hash_t do_hash ( st_data_t  key,
st_table tab 
)
inlinestatic

◆ find_entry()

static st_index_t find_entry ( st_table tab,
st_hash_t  hash_value,
st_data_t  key 
)
inlinestatic

◆ find_table_bin_ind()

static st_index_t find_table_bin_ind ( st_table tab,
st_hash_t  hash_value,
st_data_t  key 
)
static

◆ find_table_bin_ind_direct()

static st_index_t find_table_bin_ind_direct ( st_table table,
st_hash_t  hash_value,
st_data_t  key 
)
static

◆ find_table_bin_ptr_and_reserve()

static st_index_t find_table_bin_ptr_and_reserve ( st_table tab,
st_hash_t hash_value,
st_data_t  key,
st_index_t bin_ind 
)
static

◆ find_table_entry_ind()

static st_index_t find_table_entry_ind ( st_table tab,
st_hash_t  hash_value,
st_data_t  key 
)
static

◆ get_allocated_entries()

static st_index_t get_allocated_entries ( const st_table tab)
inlinestatic

◆ get_bin()

static st_index_t get_bin ( st_index_t bins,
int  s,
st_index_t  n 
)
inlinestatic

◆ get_bins_num()

static st_index_t get_bins_num ( const st_table tab)
inlinestatic

Definition at line 419 of file st.c.

References st_table::bin_power.

Referenced by bins_mask(), and make_tab_empty().

◆ get_power2()

static int get_power2 ( st_index_t  size)
static

Definition at line 328 of file st.c.

References MAX_POWER2, MINIMAL_POWER2, rb_eRuntimeError, and rb_raise().

Referenced by st_init_table_with_size().

◆ get_size_ind()

static unsigned int get_size_ind ( const st_table tab)
inlinestatic

◆ hash_bin()

static st_index_t hash_bin ( st_hash_t  hash_value,
st_table tab 
)
inlinestatic

◆ initialize_bins()

static void initialize_bins ( st_table tab)
static

Definition at line 455 of file st.c.

References st_table::bins, and bins_size().

Referenced by make_tab_empty(), and rebuild_table().

◆ make_tab_empty()

static void make_tab_empty ( st_table tab)
static

◆ murmur_finish()

static st_index_t murmur_finish ( st_index_t  h)
inlinestatic

Definition at line 1665 of file st.c.

References BIG_CONSTANT, r1, r2, and r3.

Referenced by st_hash(), and st_hash_end().

◆ murmur_step()

static st_index_t murmur_step ( st_index_t  h,
st_index_t  k 
)
inlinestatic

Definition at line 1646 of file st.c.

References C1, C2, r1, r2, and ROTL.

Referenced by st_hash(), st_hash_uint(), and st_hash_uint32().

◆ PUREFUNC()

PUREFUNC ( static st_index_t   strcasehashst_data_t)

◆ rebuild_table()

static void rebuild_table ( st_table tab)
static

◆ rebuild_table_if_necessary()

static void rebuild_table_if_necessary ( st_table tab)
inlinestatic

◆ secondary_hash()

static st_index_t secondary_hash ( st_index_t  ind,
st_table tab,
st_index_t perterb 
)
inlinestatic

◆ set_bin()

static void set_bin ( st_index_t bins,
int  s,
st_index_t  n,
st_index_t  v 
)
inlinestatic

Definition at line 358 of file st.c.

Referenced by rebuild_table(), st_add_direct_with_hash(), st_insert(), and st_insert2().

◆ st_add_direct()

void st_add_direct ( st_table tab,
st_data_t  key,
st_data_t  value 
)

Definition at line 1159 of file st.c.

References do_hash(), and st_add_direct_with_hash().

◆ st_add_direct_with_hash()

static void st_add_direct_with_hash ( st_table tab,
st_data_t  key,
st_data_t  value,
st_hash_t  hash 
)
inlinestatic

◆ st_cleanup_safe()

void st_cleanup_safe ( st_table *tab  ATTRIBUTE_UNUSED,
st_data_t never  ATTRIBUTE_UNUSED 
)

Definition at line 1358 of file st.c.

◆ st_clear()

void st_clear ( st_table tab)

◆ st_copy()

st_table* st_copy ( st_table old_tab)

Definition at line 1219 of file st.c.

References st_table::bins, bins_size(), st_table::entries, get_allocated_entries(), malloc, MEMCPY, and NULL.

◆ st_delete()

int st_delete ( st_table tab,
st_data_t key,
st_data_t value 
)

Definition at line 1294 of file st.c.

References st_general_delete().

◆ st_delete_safe()

int st_delete_safe ( st_table tab,
st_data_t key,
st_data_t value,
st_data_t never  ATTRIBUTE_UNUSED 
)

Definition at line 1305 of file st.c.

References st_general_delete().

◆ st_foreach()

int st_foreach ( st_table tab,
int(*)(ANYARGS func,
st_data_t  arg 
)

Definition at line 1527 of file st.c.

References FALSE, func, and st_general_foreach().

◆ st_foreach_check()

int st_foreach_check ( st_table tab,
int(*)(ANYARGS func,
st_data_t  arg,
st_data_t never  ATTRIBUTE_UNUSED 
)

Definition at line 1534 of file st.c.

References func, st_general_foreach(), and TRUE.

◆ st_free_table()

void st_free_table ( st_table tab)

Definition at line 664 of file st.c.

References st_table::bins, st_table::entries, free, and NULL.

◆ st_general_delete()

static int st_general_delete ( st_table tab,
st_data_t key,
st_data_t value 
)
static

◆ st_general_foreach()

static int st_general_foreach ( st_table tab,
int(*)(ANYARGS func,
st_data_t  arg,
int  check_p 
)
inlinestatic

◆ st_general_keys()

static st_index_t st_general_keys ( st_table tab,
st_data_t keys,
st_index_t  size 
)
inlinestatic

◆ st_general_values()

static st_index_t st_general_values ( st_table tab,
st_data_t values,
st_index_t  size 
)
inlinestatic

◆ st_get_key()

int st_get_key ( st_table tab,
st_data_t  key,
st_data_t result 
)

◆ st_hash()

st_index_t st_hash ( const void *  ptr,
size_t  len,
st_index_t  h 
)

Definition at line 1698 of file st.c.

References C2, CHAR_BIT, data_at, len, murmur_finish(), murmur_step(), ROTL, SIZEOF_ST_INDEX_T, st_data_t, and UNALIGNED_ADD_ALL.

Referenced by hash_i(), and strhash().

◆ st_hash_end()

st_index_t st_hash_end ( st_index_t  h)

Definition at line 1856 of file st.c.

References murmur_finish().

◆ st_hash_start()

st_index_t st_hash_start ( st_index_t  h)

Definition at line 1864 of file st.c.

Referenced by rb_hash_start().

◆ st_hash_uint()

st_index_t st_hash_uint ( st_index_t  h,
st_index_t  i 
)

Definition at line 1843 of file st.c.

References murmur_step().

◆ st_hash_uint32()

st_index_t st_hash_uint32 ( st_index_t  h,
uint32_t  i 
)

Definition at line 1837 of file st.c.

References murmur_step().

◆ st_init_numtable()

st_table* st_init_numtable ( void  )

Definition at line 608 of file st.c.

References st_init_table(), and type_numhash.

◆ st_init_numtable_with_size()

st_table* st_init_numtable_with_size ( st_index_t  size)

Definition at line 615 of file st.c.

References st_init_table_with_size(), and type_numhash.

◆ st_init_strcasetable()

st_table* st_init_strcasetable ( void  )

◆ st_init_strcasetable_with_size()

st_table* st_init_strcasetable_with_size ( st_index_t  size)

Definition at line 646 of file st.c.

References st_init_table_with_size().

◆ st_init_strtable()

st_table* st_init_strtable ( void  )

Definition at line 623 of file st.c.

References st_init_table().

◆ st_init_strtable_with_size()

st_table* st_init_strtable_with_size ( st_index_t  size)

Definition at line 630 of file st.c.

References st_init_table_with_size().

◆ st_init_table()

st_table* st_init_table ( const struct st_hash_type type)

Definition at line 600 of file st.c.

References st_init_table_with_size().

Referenced by st_init_numtable(), st_init_strcasetable(), and st_init_strtable().

◆ st_init_table_with_size()

st_table* st_init_table_with_size ( const struct st_hash_type type,
st_index_t  size 
)

◆ st_insert()

int st_insert ( st_table tab,
st_data_t  key,
st_data_t  value 
)

◆ st_insert2()

int st_insert2 ( st_table tab,
st_data_t  key,
st_data_t  value,
st_data_t(*)(st_data_t func 
)

◆ st_keys()

st_index_t st_keys ( st_table tab,
st_data_t keys,
st_index_t  size 
)

Definition at line 1564 of file st.c.

References st_general_keys().

◆ st_keys_check()

st_index_t st_keys_check ( st_table tab,
st_data_t keys,
st_index_t  size,
st_data_t never  ATTRIBUTE_UNUSED 
)

Definition at line 1571 of file st.c.

References st_general_keys().

Referenced by rb_hash_keys().

◆ st_locale_insensitive_strcasecmp()

int st_locale_insensitive_strcasecmp ( const char *  s1,
const char *  s2 
)

Definition at line 1877 of file st.c.

◆ st_locale_insensitive_strncasecmp()

int st_locale_insensitive_strncasecmp ( const char *  s1,
const char *  s2,
size_t  n 
)

Definition at line 1901 of file st.c.

References PUREFUNC(), st_data_t, and strcasehash().

◆ st_lookup()

int st_lookup ( st_table tab,
st_data_t  key,
st_data_t value 
)

◆ st_memsize()

size_t st_memsize ( const st_table tab)

◆ st_numcmp()

int st_numcmp ( st_data_t  x,
st_data_t  y 
)

Definition at line 1947 of file st.c.

◆ st_numhash()

st_index_t st_numhash ( st_data_t  n)

Definition at line 1953 of file st.c.

◆ st_shift()

int st_shift ( st_table tab,
st_data_t key,
st_data_t value 
)

◆ st_update()

int st_update ( st_table tab,
st_data_t  key,
st_update_callback_func func,
st_data_t  arg 
)

◆ st_values()

st_index_t st_values ( st_table tab,
st_data_t values,
st_index_t  size 
)

Definition at line 1601 of file st.c.

References st_general_values().

◆ st_values_check()

st_index_t st_values_check ( st_table tab,
st_data_t values,
st_index_t  size,
st_data_t never  ATTRIBUTE_UNUSED 
)

Definition at line 1608 of file st.c.

References st_general_values().

Referenced by rb_hash_values().

◆ strcasehash()

static st_index_t strcasehash ( st_data_t  arg)
static

Definition at line 1927 of file st.c.

References FNV1_32A_INIT, FNV_32_PRIME, and hval.

Referenced by st_locale_insensitive_strncasecmp().

◆ strhash()

static st_index_t strhash ( st_data_t  arg)
static

Definition at line 1870 of file st.c.

References FNV1_32A_INIT, st_hash(), and strlen().

◆ update_range_for_deleted()

static void update_range_for_deleted ( st_table tab,
st_index_t  n 
)
inlinestatic

Definition at line 1244 of file st.c.

References st_table::entries_start.

Referenced by st_general_delete(), st_general_foreach(), st_shift(), and st_update().

Variable Documentation

◆ features

const struct st_features features[]
static

Definition at line 264 of file st.c.

Referenced by get_loaded_features_index(), rb_feature_p(), and rb_provide_feature().

◆ st_hashtype_num

const struct st_hash_type st_hashtype_num
Initial value:
= {
}
st_index_t st_numhash(st_data_t n)
Definition: st.c:1953
int st_numcmp(st_data_t x, st_data_t y)
Definition: st.c:1947

Definition at line 138 of file st.c.

◆ type_strcasehash

const struct st_hash_type type_strcasehash
static
Initial value:
= {
}
int st_locale_insensitive_strcasecmp(const char *s1, const char *s2)
Definition: st.c:1877
static st_index_t strcasehash(st_data_t)
Definition: st.c:1927

Definition at line 151 of file st.c.

◆ type_strhash

const struct st_hash_type type_strhash
static
Initial value:
= {
strcmp,
}
static st_index_t strhash(st_data_t)
Definition: st.c:1870

Definition at line 145 of file st.c.