This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Typedefs | |
| typedef WsHashRec * | WsHashPtr |
| typedef void(* | WsHashItemDestructor )(void *item, void *context) |
Functions | |
| WsHashPtr | ws_hash_create (WsHashItemDestructor destructor, void *contex) |
| void | ws_hash_destroy (WsHashPtr hash) |
| WsBool | ws_hash_put (WsHashPtr hash, const char *name, void *data) |
| void * | ws_hash_get (WsHashPtr hash, const char *name) |
| void | ws_hash_clear (WsHashPtr hash) |
|
|
|
|
|
Definition at line 76 of file wshash.h. Referenced by ws_function_hash_create(), ws_hash_clear(), ws_hash_create(), ws_hash_destroy(), ws_hash_get(), ws_hash_put(), ws_pragma_use_hash_create(), and ws_variable_hash_create(). |
|
|
Definition at line 180 of file wshash.c. References WsHashItemRec::data, WsHashRec::destructor, WsHashRec::destructor_context, WsHashRec::items, WsHashItemRec::name, WsHashItemRec::next, ws_free(), WsHashItem, and WsHashPtr. Referenced by ws_hash_destroy(). 00181 {
00182 WsHashItem *i, *n;
00183 size_t j;
00184
00185 for (j = 0; j < WS_HASH_TABLE_SIZE; j++) {
00186 for (i = hash->items[j]; i; i = n) {
00187 n = i->next;
00188 if (hash->destructor)
00189 (*hash->destructor)(i->data, hash->destructor_context);
00190
00191 ws_free(i->name);
00192 ws_free(i);
00193 }
00194 hash->items[j] = NULL;
00195 }
00196 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 103 of file wshash.c. References WsHashRec::destructor, WsHashRec::destructor_context, ws_calloc(), and WsHashPtr. Referenced by ws_function_hash_create(), ws_pragma_use_hash_create(), and ws_variable_hash_create(). 00104 {
00105 WsHashPtr hash = ws_calloc(1, sizeof(*hash));
00106
00107 if (hash) {
00108 hash->destructor = destructor;
00109 hash->destructor_context = context;
00110 }
00111
00112 return hash;
00113 }
|
Here is the call graph for this function:

|
|
Definition at line 116 of file wshash.c. References ws_free(), ws_hash_clear(), and WsHashPtr. Referenced by compile_stream(). 00117 {
00118 if (hash == NULL)
00119 return;
00120
00121 ws_hash_clear(hash);
00122 ws_free(hash);
00123 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 167 of file wshash.c. References count_hash(), WsHashItemRec::data, WsHashRec::items, WsHashItemRec::name, name, WsHashItemRec::next, WsHashItem, and WsHashPtr. Referenced by ws_expr_linearize(), ws_function_hash(), ws_pragma_use(), ws_variable_define(), and ws_variable_lookup(). 00168 {
00169 WsHashItem *i;
00170 size_t h = count_hash(name);
00171
00172 for (i = hash->items[h]; i; i = i->next)
00173 if (strcmp(i->name, name) == 0)
00174 return i->data;
00175
00176 return NULL;
00177 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 126 of file wshash.c. References count_hash(), WsHashItemRec::data, WsHashRec::destructor, WsHashRec::destructor_context, WsHashRec::items, WsHashItemRec::name, name, WsHashItemRec::next, ws_calloc(), ws_free(), ws_strdup(), WsBool, WsHashItem, and WsHashPtr. Referenced by ws_function_hash(), ws_pragma_use(), and ws_variable_define(). 00127 {
00128 WsHashItem *i;
00129 size_t h = count_hash(name);
00130
00131 for (i = hash->items[h]; i; i = i->next) {
00132 if (strcmp(i->name, name) == 0) {
00133 /* Found it. */
00134
00135 /* Destroy the old item */
00136 if (hash->destructor)
00137 (*hash->destructor)(i->data, hash->destructor_context);
00138
00139 i->data = data;
00140
00141 return WS_FALSE;
00142 }
00143 }
00144
00145 /* Must create a new mapping. */
00146 i = ws_calloc(1, sizeof(*i));
00147
00148 if (i == NULL)
00149 return WS_FALSE;
00150
00151 i->name = ws_strdup(name);
00152 if (i->name == NULL) {
00153 ws_free(i);
00154 return WS_FALSE;
00155 }
00156
00157 i->data = data;
00158
00159 /* Link it to our hash. */
00160 i->next = hash->items[h];
00161 hash->items[h] = i;
00162
00163 return WS_TRUE;
00164 }
|
Here is the call graph for this function:
