CUBRID Engine
latest
|
#include <pthread.h>
#include <stdio.h>
Go to the source code of this file.
Classes | |
struct | dlisth_s |
Macros | |
#define | dlisth_init(h) |
#define | dlisth_is_empty(h) ((h)->next == (h) && (h)->prev == (h)) |
#define | dlisth_delete(h_) |
#define | dlisth_insert_before(ih, bh) |
#define | dlisth_insert_after(ih, bh) |
#define | API_MUTEX pthread_mutex_t |
#define | API_MUTEX_INIT(m) pthread_mutex_init(m,NULL) |
#define | API_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER |
#define | API_LOCK(m) pthread_mutex_lock(m) |
#define | API_UNLOCK(m) pthread_mutex_unlock(m) |
#define | API_TRYLOCK(m) pthread_mutex_trylock(m) |
#define | API_MUTEX_DESTROY(m) pthread_mutex_destroy(m) |
#define | API_ONCE_TYPE pthread_once_t |
#define | API_ONCE_INIT PTHREAD_ONCE_INIT |
#define | API_ONCE_FUNC(t, r) pthread_once(t,r) |
#define | API_CALLOC(n, s) api_calloc((n),(s),__FILE__,__LINE__) |
#define | API_MALLOC(s) api_malloc((s),__FILE__,__LINE__) |
#define | API_FREE(p) api_free((p), __FILE__, __LINE__) |
Typedefs | |
typedef struct dlisth_s | dlisth |
typedef int(* | dlist_map_func) (dlisth *h, void *arg, int *cont) |
typedef struct hash_table_s | hash_table |
typedef int(* | ht_comparef) (void *key1, void *key2, int *r) |
typedef int(* | ht_hashf) (void *key, unsigned int *rv) |
typedef int(* | ht_keyf) (void *elem, void **rk) |
typedef void(* | ht_destroyf) (void *elem) |
Functions | |
int | dlisth_map (dlisth *h, dlist_map_func func, void *arg) |
int | hash_new (int bucket_sz, ht_hashf hashf, ht_keyf keyf, ht_comparef comparef, hash_table **ht) |
void | hash_destroy (hash_table *ht, ht_destroyf dtor) |
int | hash_lookup (hash_table *ht, void *key, void **elem) |
int | hash_insert (hash_table *ht, void *elem) |
int | hash_delete (hash_table *ht, void *key, void **elem) |
void * | api_calloc (size_t nmemb, size_t size, const char *file, int line) |
void * | api_malloc (size_t size, const char *file, int line) |
void | api_free (void *ptr, const char *file, int line) |
int | api_check_memory (FILE *fp) |
Variables | |
int | api_malloc_dhook_flag_set |
#define API_CALLOC | ( | n, | |
s | |||
) | api_calloc((n),(s),__FILE__,__LINE__) |
Definition at line 110 of file api_util.h.
Referenced by api_col_insert(), api_ores_apply_update(), api_qres_update_value(), array_indexer_create(), ci_create_connection_impl(), ci_stmt_set_parameter_impl(), create_resultset_impl(), or_create(), vbt_lazy_init_db_value(), xcol_copy(), and xcol_to_cci_set().
Definition at line 112 of file api_util.h.
Referenced by ai_api_destroy(), api_col_insert(), api_object_resultset_pool_create(), api_ores_apply_update(), api_val_dtor(), apif_collection_create(), array_indexer_create(), ci_conn_create_statement_impl(), ci_create_connection_impl(), ci_stmt_add_batch_impl(), col_api_destroy(), connection_impl_dtor(), create_cci_object(), create_db_value_bind_table(), create_resultset_impl(), destroy_cci_object(), fe_alloc_handle(), fe_destroy(), fe_destroy_handle_worker(), get_value_from_tset(), hash_delete(), hash_destroy(), li_api_delete(), li_api_destroy(), opool_create(), opool_destroy(), opool_ght_elem_dtor(), or_create(), or_destroy(), or_res_bind_destroy(), or_rm_bind_destroy(), orp_api_destroy(), resultset_impl_dtor(), set_value_to_api_val(), sh_destroy(), statement_impl_dtor(), stmt_complete_batch(), stmt_execute_batch_sql(), vbt_api_destroy(), vbt_dtor(), vbt_lazy_init_db_value(), vbt_resetf_map(), xcol_copy(), xcol_create(), xcol_destroy(), and xcol_to_cci_set().
#define API_LOCK | ( | m | ) | pthread_mutex_lock(m) |
Definition at line 100 of file api_util.h.
Referenced by api_calloc(), api_check_memory(), api_free(), api_malloc(), bh_root_acquire(), and bh_root_release().
#define API_MALLOC | ( | s | ) | api_malloc((s),__FILE__,__LINE__) |
Definition at line 111 of file api_util.h.
Referenced by api_object_resultset_pool_create(), api_ores_apply_update(), apif_collection_create(), array_indexer_create(), be_create_static_hash(), ci_conn_create_statement_impl(), ci_stmt_add_batch_impl(), ci_stmt_add_batch_query_impl(), create_cci_object(), create_db_value_bind_table(), create_handle_context(), fe_alloc_handle(), get_value_from_tset(), hash_insert(), hash_new(), li_api_insert(), list_indexer_create(), opool_create(), or_res_bind_create(), or_rm_bind_create(), set_value_to_api_val(), stmt_execute_batch_sql(), and xcol_create().
#define API_MUTEX pthread_mutex_t |
Definition at line 97 of file api_util.h.
#define API_MUTEX_DESTROY | ( | m | ) | pthread_mutex_destroy(m) |
Definition at line 103 of file api_util.h.
#define API_MUTEX_INIT | ( | m | ) | pthread_mutex_init(m,NULL) |
Definition at line 98 of file api_util.h.
Referenced by once_function(), and rr_init_root().
#define API_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER |
Definition at line 99 of file api_util.h.
#define API_ONCE_FUNC | ( | t, | |
r | |||
) | pthread_once(t,r) |
Definition at line 106 of file api_util.h.
Referenced by api_calloc(), api_check_memory(), api_free(), and api_malloc().
#define API_ONCE_INIT PTHREAD_ONCE_INIT |
Definition at line 105 of file api_util.h.
#define API_ONCE_TYPE pthread_once_t |
Definition at line 104 of file api_util.h.
#define API_TRYLOCK | ( | m | ) | pthread_mutex_trylock(m) |
Definition at line 102 of file api_util.h.
Referenced by bh_root_lock().
#define API_UNLOCK | ( | m | ) | pthread_mutex_unlock(m) |
Definition at line 101 of file api_util.h.
Referenced by api_calloc(), api_check_memory(), api_free(), api_malloc(), bh_root_acquire(), bh_root_lock(), bh_root_release(), and bh_root_unlock().
#define dlisth_delete | ( | h_ | ) |
Definition at line 50 of file api_util.h.
Referenced by api_free(), hash_delete(), hash_destroy(), li_api_delete(), li_api_destroy(), and stmt_complete_batch().
#define dlisth_init | ( | h | ) |
Definition at line 42 of file api_util.h.
Referenced by ci_stmt_add_batch_impl(), ci_stmt_add_batch_query_impl(), create_handle_context(), hash_new(), init_statement_impl(), li_api_insert(), list_indexer_create(), make_debug_h(), once_function(), and stmt_complete_batch().
#define dlisth_insert_after | ( | ih, | |
bh | |||
) |
Definition at line 68 of file api_util.h.
Referenced by api_calloc(), api_malloc(), fe_alloc_handle(), hash_insert(), li_api_insert(), and stmt_complete_batch().
#define dlisth_insert_before | ( | ih, | |
bh | |||
) |
Definition at line 58 of file api_util.h.
Referenced by ci_stmt_add_batch_impl(), ci_stmt_add_batch_query_impl(), and fe_bind_graft().
#define dlisth_is_empty | ( | h | ) | ((h)->next == (h) && (h)->prev == (h)) |
Definition at line 48 of file api_util.h.
Referenced by api_check_memory(), fe_bind_get_first_child(), fe_destroy_handle_worker(), li_api_destroy(), and stmt_complete_batch().
typedef int(* dlist_map_func) (dlisth *h, void *arg, int *cont) |
Definition at line 38 of file api_util.h.
Definition at line 30 of file api_util.h.
typedef struct hash_table_s hash_table |
Definition at line 80 of file api_util.h.
typedef int(* ht_comparef) (void *key1, void *key2, int *r) |
Definition at line 82 of file api_util.h.
typedef void(* ht_destroyf) (void *elem) |
Definition at line 88 of file api_util.h.
typedef int(* ht_hashf) (void *key, unsigned int *rv) |
Definition at line 84 of file api_util.h.
typedef int(* ht_keyf) (void *elem, void **rk) |
Definition at line 86 of file api_util.h.
void* api_calloc | ( | size_t | nmemb, |
size_t | size, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 366 of file api_util.c.
References API_LOCK, api_malloc_dhook_flag_set, API_ONCE_FUNC, API_UNLOCK, assert, dlisth_insert_after, make_debug_h(), malloc_count, MALLOC_HEADER_SZ, mutex, once, and once_function().
int api_check_memory | ( | FILE * | fp | ) |
Definition at line 458 of file api_util.c.
References API_LOCK, api_malloc_dhook_flag_set, API_ONCE_FUNC, API_UNLOCK, dlisth_is_empty, dump_debug_h(), free_count, malloc_count, mutex, dlisth_s::next, once, and once_function().
void api_free | ( | void * | ptr, |
const char * | file, | ||
int | line | ||
) |
Definition at line 431 of file api_util.c.
References API_LOCK, api_malloc_dhook_flag_set, API_ONCE_FUNC, API_UNLOCK, dlisth_delete, free_count, MALLOC_HEADER_SZ, mutex, NULL, once, once_function(), and p.
void* api_malloc | ( | size_t | size, |
const char * | file, | ||
int | line | ||
) |
Definition at line 399 of file api_util.c.
References API_LOCK, api_malloc_dhook_flag_set, API_ONCE_FUNC, API_UNLOCK, assert, dlisth_insert_after, make_debug_h(), malloc_count, MALLOC_HEADER_SZ, mutex, once, and once_function().
int dlisth_map | ( | dlisth * | h, |
dlist_map_func | func, | ||
void * | arg | ||
) |
Definition at line 138 of file api_util.c.
References assert, dlisth_s::next, NO_ERROR, and NULL.
Referenced by li_api_map().
int hash_delete | ( | hash_table * | ht, |
void * | key, | ||
void ** | elem | ||
) |
Definition at line 318 of file api_util.c.
References API_FREE, assert, hash_table_s::bucket_sz, hash_table_s::buckets, hash_table_s::comparef, dlisth_delete, ht_elem_s::elem, hash_table_s::hashf, ht_elem_s::head, hash_table_s::keyf, dlisth_s::next, NO_ERROR, NULL, and rc.
Referenced by opool_oid_delete(), and sh_delete().
void hash_destroy | ( | hash_table * | ht, |
ht_destroyf | dtor | ||
) |
Definition at line 198 of file api_util.c.
References API_FREE, assert, hash_table_s::bucket_sz, hash_table_s::buckets, dlisth_delete, ht_elem_s::elem, ht_bucket_s::head, i, dlisth_s::next, and NULL.
Referenced by be_create_static_hash(), opool_create(), opool_destroy(), orp_api_destroy(), and sh_destroy().
int hash_insert | ( | hash_table * | ht, |
void * | elem | ||
) |
Definition at line 275 of file api_util.c.
References API_MALLOC, assert, hash_table_s::bucket_sz, hash_table_s::buckets, dlisth_insert_after, ht_elem_s::elem, ER_INTERFACE_NO_MORE_MEMORY, hash_table_s::hashf, ht_elem_s::head, hash_table_s::keyf, NO_ERROR, NULL, and rc.
Referenced by opool_get_object_resultset(), and sh_insert().
int hash_lookup | ( | hash_table * | ht, |
void * | key, | ||
void ** | elem | ||
) |
Definition at line 233 of file api_util.c.
References assert, hash_table_s::bucket_sz, hash_table_s::buckets, hash_table_s::comparef, ht_elem_s::elem, hash_table_s::hashf, ht_elem_s::head, hash_table_s::keyf, dlisth_s::next, NO_ERROR, NULL, and rc.
Referenced by opool_get_object_resultset(), orp_api_get_object_resultset(), orp_oid_delete(), orp_oid_get_classname(), and sh_lookup().
int hash_new | ( | int | bucket_sz, |
ht_hashf | hashf, | ||
ht_keyf | keyf, | ||
ht_comparef | comparef, | ||
hash_table ** | ht | ||
) |
Definition at line 166 of file api_util.c.
References API_MALLOC, assert, hash_table_s::bucket_sz, hash_table_s::buckets, hash_table_s::comparef, dlisth_init, ER_INTERFACE_NO_MORE_MEMORY, hash_table_s::hashf, ht_bucket_s::head, i, hash_table_s::keyf, NO_ERROR, and NULL.
Referenced by api_object_resultset_pool_create(), be_create_static_hash(), and opool_create().
int api_malloc_dhook_flag_set |
Definition at line 79 of file api_util.c.
Referenced by api_calloc(), api_check_memory(), api_free(), and api_malloc().