#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().
00027 {ST_CONTINUE, ST_STOP, ST_DELETE}; |
|
参照先 ADD_DIRECT, do_hash, と st_table::num_bins.
00311 { 00312 unsigned int hash_val, bin_pos; 00313 00314 hash_val = do_hash(key, table); 00315 bin_pos = hash_val % table->num_bins; 00316 ADD_DIRECT(table, key, value, hash_val, bin_pos); 00317 } |
|
参照先 delete_never(), st_table::num_entries, と st_foreach().
00468 { 00469 int num_entries = table->num_entries; 00470 00471 st_foreach(table, delete_never, never); 00472 table->num_entries = num_entries; 00473 } |
|
参照先 alloc, st_table::bins, Calloc, st_table_entry::next, st_table::num_bins, と st_table_entry.
00348 { 00349 st_table *new_table; 00350 st_table_entry *ptr, *entry; 00351 int i, num_bins = old_table->num_bins; 00352 00353 new_table = alloc(st_table); 00354 if (new_table == 0) { 00355 return 0; 00356 } 00357 00358 *new_table = *old_table; 00359 new_table->bins = (st_table_entry**) 00360 Calloc((unsigned)num_bins, sizeof(st_table_entry*)); 00361 00362 if (new_table->bins == 0) { 00363 free(new_table); 00364 return 0; 00365 } 00366 00367 for(i = 0; i < num_bins; i++) { 00368 new_table->bins[i] = 0; 00369 ptr = old_table->bins[i]; 00370 while (ptr != 0) { 00371 entry = alloc(st_table_entry); 00372 if (entry == 0) { 00373 free(new_table->bins); 00374 free(new_table); 00375 return 0; 00376 } 00377 *entry = *ptr; 00378 entry->next = new_table->bins[i]; 00379 new_table->bins[i] = entry; 00380 ptr = ptr->next; 00381 } 00382 } 00383 return new_table; 00384 } |
|
|
|
|
|
参照先 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().
00477 { 00478 st_table_entry *ptr, *last, *tmp; 00479 enum st_retval retval; 00480 int i; 00481 00482 for(i = 0; i < table->num_bins; i++) { 00483 last = 0; 00484 for(ptr = table->bins[i]; ptr != 0;) { 00485 retval = (*func)(ptr->key, ptr->record, arg); 00486 switch (retval) { 00487 case ST_CONTINUE: 00488 last = ptr; 00489 ptr = ptr->next; 00490 break; 00491 case ST_STOP: 00492 return; 00493 case ST_DELETE: 00494 tmp = ptr; 00495 if (last == 0) { 00496 table->bins[i] = ptr->next; 00497 } 00498 else { 00499 last->next = ptr->next; 00500 } 00501 ptr = ptr->next; 00502 free(tmp); 00503 table->num_entries--; 00504 } 00505 } 00506 } 00507 } |
|
参照先 st_table::bins, st_table_entry::next, st_table::num_bins, と st_table_entry.
00208 { 00209 register st_table_entry *ptr, *next; 00210 int i; 00211 00212 for(i = 0; i < table->num_bins; i++) { 00213 ptr = table->bins[i]; 00214 while (ptr != 0) { 00215 next = ptr->next; 00216 free(ptr); 00217 ptr = next; 00218 } 00219 } 00220 free(table->bins); 00221 free(table); 00222 } |
|
参照先 st_init_table(), と type_numhash.
00181 { 00182 return st_init_table(&type_numhash); 00183 } |
|
参照先 st_init_table_with_size(), と type_numhash.
00188 { 00189 return st_init_table_with_size(&type_numhash, size); 00190 } |
|
参照先 st_init_table(), と type_strhash.
00194 { 00195 return st_init_table(&type_strhash); 00196 } |
|
参照先 st_init_table_with_size(), と type_strhash.
00201 { 00202 return st_init_table_with_size(&type_strhash, size); 00203 } |
|
参照先 st_init_table_with_size(). 参照元 st_init_numtable(), と st_init_strtable().
00175 { 00176 return st_init_table_with_size(type, 0); 00177 } |
|
参照先 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().
00153 { 00154 st_table *tbl; 00155 00156 #ifdef HASH_LOG 00157 if (init_st == 0) { 00158 init_st = 1; 00159 atexit(stat_col); 00160 } 00161 #endif 00162 00163 size = new_size(size); /* round up to prime number */ 00164 00165 tbl = alloc(st_table); 00166 tbl->type = type; 00167 tbl->num_entries = 0; 00168 tbl->num_bins = size; 00169 tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*)); 00170 00171 return tbl; 00172 } |
|
|
|
参照先 do_hash, FIND_ENTRY, st_table_entry::record, と st_table_entry.
00250 { 00251 unsigned int hash_val, bin_pos; 00252 register st_table_entry *ptr; 00253 00254 hash_val = do_hash(key, table); 00255 FIND_ENTRY(table, ptr, hash_val, bin_pos); 00256 00257 if (ptr == 0) { 00258 return 0; 00259 } 00260 else { 00261 if (value != 0) *value = ptr->record; 00262 return 1; 00263 } 00264 } |