#include "dkcOSIndependent.h"
st.hのインクルード依存関係図

このグラフは、どのファイルから直接、間接的にインクルードされているかを示しています。

構成 | |
| struct | st_hash_type |
| struct | st_table |
マクロ定義 | |
| #define | st_is_member(table, key) st_lookup(table,key,(char **)0) |
型定義 | |
| typedef st_table | st_table |
列挙型 | |
| enum | st_retval { ST_CONTINUE, ST_STOP, ST_DELETE } |
関数 | |
| DKC_EXTERN st_table * | st_init_table_with_size (struct st_hash_type *type, int size) |
| DKC_EXTERN st_table * | st_init_table (struct st_hash_type *type) |
| DKC_EXTERN st_table * | st_init_numtable () |
| DKC_EXTERN st_table * | st_init_numtable_with_size (int size) |
| DKC_EXTERN st_table * | st_init_strtable () |
| DKC_EXTERN st_table * | st_init_strtable_with_size (int size) |
| DKC_EXTERN void | st_free_table (st_table *table) |
| DKC_EXTERN int | st_lookup (st_table *table, register char *key, char **value) |
| DKC_EXTERN int | st_insert (st_table *table, char *key, char *value) |
| DKC_EXTERN void | st_add_direct (st_table *table, char *key, char *value) |
| DKC_EXTERN st_table * | st_copy (st_table *old_table) |
| DKC_EXTERN int | st_delete (st_table *table, char **key, char **value) |
| DKC_EXTERN int | st_delete_safe (st_table *table, char **key, char **value, char *never) |
| DKC_EXTERN void | st_cleanup_safe (st_table *table, char *never) |
| DKC_EXTERN void | st_foreach (st_table *table, int(*func)(), char *arg) |
st.h で定義されています。
|
|
|
|
|
|
|
|
参照元 st_foreach().
00028 {ST_CONTINUE, ST_STOP, ST_DELETE};
|
|
||||||||||||||||
|
参照先 ADD_DIRECT, と do_hash.
00316 {
00317 unsigned int hash_val, bin_pos;
00318
00319 hash_val = do_hash(key, table);
00320 bin_pos = hash_val % table->num_bins;
00321 ADD_DIRECT(table, key, value, hash_val, bin_pos);
00322 }
|
|
||||||||||||
|
参照先 delete_never(), st_table::num_entries, と st_foreach().
00474 {
00475 int num_entries = table->num_entries;
00476
00477 st_foreach(table, delete_never, never);
00478 table->num_entries = num_entries;
00479 }
|
|
|
参照先 alloc, st_table::bins, Calloc, st_table_entry::next, と st_table_entry.
00353 {
00354 st_table *new_table;
00355 st_table_entry *ptr, *entry;
00356 int i, num_bins = old_table->num_bins;
00357
00358 new_table = alloc(st_table);
00359 if (new_table == 0) {
00360 return 0;
00361 }
00362
00363 *new_table = *old_table;
00364 new_table->bins = (st_table_entry**)
00365 Calloc((unsigned)num_bins, sizeof(st_table_entry*));
00366
00367 if (new_table->bins == 0) {
00368 free(new_table);
00369 return 0;
00370 }
00371
00372 for(i = 0; i < num_bins; i++) {
00373 new_table->bins[i] = 0;
00374 ptr = old_table->bins[i];
00375 while (ptr != 0) {
00376 entry = alloc(st_table_entry);
00377 if (entry == 0) {
00378 free(new_table->bins);
00379 free(new_table);
00380 return 0;
00381 }
00382 *entry = *ptr;
00383 entry->next = new_table->bins[i];
00384 new_table->bins[i] = entry;
00385 ptr = ptr->next;
00386 }
00387 }
00388 return new_table;
00389 }
|
|
||||||||||||||||
|
参照先 do_hash_bin, EQUAL, st_table_entry::key, st_table_entry::next, st_table_entry::record, と st_table_entry.
00396 {
00397 unsigned int hash_val;
00398 st_table_entry *tmp;
00399 register st_table_entry *ptr;
00400
00401 hash_val = do_hash_bin(*key, table);
00402 ptr = table->bins[hash_val];
00403
00404 if (ptr == 0) {
00405 if (value != 0) *value = 0;
00406 return 0;
00407 }
00408
00409 if (EQUAL(table, *key, ptr->key)) {
00410 table->bins[hash_val] = ptr->next;
00411 table->num_entries--;
00412 if (value != 0) *value = ptr->record;
00413 *key = ptr->key;
00414 free(ptr);
00415 return 1;
00416 }
00417
00418 for(; ptr->next != 0; ptr = ptr->next) {
00419 if (EQUAL(table, ptr->next->key, *key)) {
00420 tmp = ptr->next;
00421 ptr->next = ptr->next->next;
00422 table->num_entries--;
00423 if (value != 0) *value = tmp->record;
00424 *key = tmp->key;
00425 free(tmp);
00426 return 1;
00427 }
00428 }
00429
00430 return 0;
00431 }
|
|
||||||||||||||||||||
|
参照先 do_hash_bin, EQUAL, st_table_entry::key, st_table_entry::next, st_table_entry::record, と st_table_entry.
00439 {
00440 unsigned int hash_val;
00441 register st_table_entry *ptr;
00442
00443 hash_val = do_hash_bin(*key, table);
00444 ptr = table->bins[hash_val];
00445
00446 if (ptr == 0) {
00447 if (value != 0) *value = 0;
00448 return 0;
00449 }
00450
00451 for(; ptr != 0; ptr = ptr->next) {
00452 if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) {
00453 table->num_entries--;
00454 *key = ptr->key;
00455 if (value != 0) *value = ptr->record;
00456 ptr->key = ptr->record = never;
00457 return 1;
00458 }
00459 }
00460
00461 return 0;
00462 }
|
|
||||||||||||||||
|
参照先 st_table::bins, st_table_entry::key, st_table_entry::next, st_table::num_bins, st_table::num_entries, st_table_entry::record, ST_CONTINUE, ST_DELETE, st_retval, ST_STOP, と st_table_entry. 参照元 st_cleanup_safe().
00483 {
00484 st_table_entry *ptr, *last, *tmp;
00485 enum st_retval retval;
00486 int i;
00487
00488 for(i = 0; i < table->num_bins; i++) {
00489 last = 0;
00490 for(ptr = table->bins[i]; ptr != 0;) {
00491 retval = (*func)(ptr->key, ptr->record, arg);
00492 switch (retval) {
00493 case ST_CONTINUE:
00494 last = ptr;
00495 ptr = ptr->next;
00496 break;
00497 case ST_STOP:
00498 return;
00499 case ST_DELETE:
00500 tmp = ptr;
00501 if (last == 0) {
00502 table->bins[i] = ptr->next;
00503 }
00504 else {
00505 last->next = ptr->next;
00506 }
00507 ptr = ptr->next;
00508 free(tmp);
00509 table->num_entries--;
00510 }
00511 }
00512 }
00513 }
|
|
|
参照先 st_table_entry::next, と st_table_entry.
00213 {
00214 register st_table_entry *ptr, *next;
00215 int i;
00216
00217 for(i = 0; i < table->num_bins; i++) {
00218 ptr = table->bins[i];
00219 while (ptr != 0) {
00220 next = ptr->next;
00221 free(ptr);
00222 ptr = next;
00223 }
00224 }
00225 free(table->bins);
00226 free(table);
00227 }
|
|
|
参照先 st_init_table(), と type_numhash.
00186 {
00187 return st_init_table(&type_numhash);
00188 }
|
|
|
参照先 st_init_table_with_size(), と type_numhash.
00193 {
00194 return st_init_table_with_size(&type_numhash, size);
00195 }
|
|
|
参照先 st_init_table(), と type_strhash.
00199 {
00200 return st_init_table(&type_strhash);
00201 }
|
|
|
参照先 st_init_table_with_size(), と type_strhash.
00206 {
00207 return st_init_table_with_size(&type_strhash, size);
00208 }
|
|
|
参照先 st_init_table_with_size(). 参照元 st_init_numtable(), と st_init_strtable().
00180 {
00181 return st_init_table_with_size(type, 0);
00182 }
|
|
||||||||||||
|
参照先 alloc, st_table::bins, Calloc, new_size(), st_table::num_bins, st_table::num_entries, st_table_entry, と st_table::type. 参照元 st_init_numtable_with_size(), st_init_strtable_with_size(), と st_init_table().
00156 {
00157 st_table *tbl;
00158
00159 #ifdef HASH_LOG
00160 if (init_st == 0) {
00161 init_st = 1;
00162 atexit(stat_col);
00163 }
00164 #endif
00165
00166 size = new_size(size); /* round up to prime number */
00167
00168 tbl = alloc(st_table);
00169 tbl->type = type;
00170 tbl->num_entries = 0;
00171 tbl->num_bins = size;
00172 tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*));
00173
00174 return tbl;
00175 }
|
|
||||||||||||||||
|
参照先 ADD_DIRECT, do_hash, FIND_ENTRY, st_table_entry::record, と st_table_entry.
00294 {
00295 unsigned int hash_val, bin_pos;
00296 register st_table_entry *ptr;
00297
00298 hash_val = do_hash(key, table);
00299 FIND_ENTRY(table, ptr, hash_val, bin_pos);
00300
00301 if (ptr == 0) {
00302 ADD_DIRECT(table, key, value, hash_val, bin_pos);
00303 return 0;
00304 }
00305 else {
00306 ptr->record = value;
00307 return 1;
00308 }
00309 }
|
|
||||||||||||||||
|
|
1.3.6