CUBRID Engine  latest
esql_hash.c File Reference
#include "config.h"
#include <stdlib.h>
#include "util_func.h"
#include "misc_string.h"
#include "esql_hash.h"
#include "esql_misc.h"
#include "memory_alloc.h"
Include dependency graph for esql_hash.c:

Go to the source code of this file.

Classes

struct  bucket
 
struct  hash_tab_impl
 

Typedefs

typedef struct bucket BUCKET
 
typedef struct hash_tab_impl HASH_TAB_IMPL
 

Enumerations

enum  { MSG_INTERNAL_ERROR = 1, MSG_TABLE_OVERFLOW = 2 }
 

Functions

static void es_write_log (const char *fname, const char *msg)
 
static int es_symcmp (const void *p1, const void *p2)
 
static void es_ht_free_table (HASH_TAB *table, HT_FREE_FN free_fn)
 
static void * es_ht_add_symbol (HASH_TAB *table, void *sym)
 
static void es_ht_remove_symbol (HASH_TAB *table, void *sym)
 
static void * es_ht_find_symbol (HASH_TAB *table, void *sym)
 
static void * es_ht_next_symbol (HASH_TAB *tbl, void *last_sym)
 
static int es_ht_print_table (HASH_TAB *table, void(*print)(BUCKET *, void *), void *param, int sort)
 
static int es_ht_get_symbol_count (HASH_TAB *table)
 
void * es_ht_alloc_new_symbol (int size)
 
void es_ht_free_symbol (void *sym)
 
HASH_TABes_ht_make_table (unsigned maxsym, HT_HASH_FN hash_function, HT_CMP_FN cmp_function)
 

Variables

static HT_CMP_FN es_User_cmp
 

Typedef Documentation

typedef struct bucket BUCKET

Definition at line 35 of file esql_hash.c.

typedef struct hash_tab_impl HASH_TAB_IMPL

Definition at line 42 of file esql_hash.c.

Enumeration Type Documentation

anonymous enum
Enumerator
MSG_INTERNAL_ERROR 
MSG_TABLE_OVERFLOW 

Definition at line 53 of file esql_hash.c.

Function Documentation

static void * es_ht_add_symbol ( HASH_TAB table,
void *  sym 
)
static

Definition at line 144 of file esql_hash.c.

References hash_tab_impl::hash, if(), bucket::next, hash_tab_impl::numsyms, p, bucket::prev, hash_tab_impl::size, and hash_tab_impl::table.

Referenced by es_ht_make_table().

Here is the caller graph for this function:

void* es_ht_alloc_new_symbol ( int  size)

Definition at line 351 of file esql_hash.c.

References NULL, and pp_malloc().

Referenced by pp_new_cursor(), pp_new_stmt(), pp_new_structdef(), and pp_new_symbol().

Here is the caller graph for this function:

static void * es_ht_find_symbol ( HASH_TAB table,
void *  sym 
)
static

Definition at line 199 of file esql_hash.c.

References hash_tab_impl::cmp, hash_tab_impl::hash, bucket::next, NULL, p, hash_tab_impl::size, hash_tab_impl::table, and while().

Referenced by es_ht_make_table().

Here is the caller graph for this function:

void es_ht_free_symbol ( void *  sym)

Definition at line 369 of file esql_hash.c.

References free_and_init.

Referenced by pp_discard_structdef(), pp_discard_symbol(), pp_free_cursor(), pp_free_stmt(), and pp_symbol_finish().

Here is the caller graph for this function:

static void es_ht_free_table ( HASH_TAB table,
HT_FREE_FN  free_fn 
)
static

Definition at line 113 of file esql_hash.c.

References free_and_init, i, bucket::next, NULL, hash_tab_impl::size, and hash_tab_impl::table.

Referenced by es_ht_make_table().

Here is the caller graph for this function:

static int es_ht_get_symbol_count ( HASH_TAB table)
static

Definition at line 338 of file esql_hash.c.

References hash_tab_impl::numsyms.

Referenced by es_ht_make_table().

Here is the caller graph for this function:

static void * es_ht_next_symbol ( HASH_TAB tbl,
void *  last_sym 
)
static

Definition at line 229 of file esql_hash.c.

References hash_tab_impl::cmp, bucket::next, and NULL.

Referenced by es_ht_make_table().

Here is the caller graph for this function:

static int es_ht_print_table ( HASH_TAB table,
void(*)(BUCKET *, void *)  print,
void *  param,
int  sort 
)
static
static void es_ht_remove_symbol ( HASH_TAB table,
void *  sym 
)
static

Definition at line 174 of file esql_hash.c.

References if(), bucket::next, hash_tab_impl::numsyms, and bucket::prev.

Referenced by es_ht_make_table().

Here is the caller graph for this function:

static int es_symcmp ( const void *  p1,
const void *  p2 
)
static

Definition at line 100 of file esql_hash.c.

References es_User_cmp.

Referenced by es_ht_print_table().

Here is the caller graph for this function:

static void es_write_log ( const char *  fname,
const char *  msg 
)
static

Definition at line 81 of file esql_hash.c.

References EX_HASH_SET, free_and_init, MSG_INTERNAL_ERROR, pp_get_msg(), and pp_strdup().

Referenced by es_ht_print_table().

Here is the caller graph for this function:

Variable Documentation

HT_CMP_FN es_User_cmp
static

Definition at line 61 of file esql_hash.c.

Referenced by es_ht_print_table(), and es_symcmp().