00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00028 #include "dbprim.h"
00029 #include "dbprim_int.h"
00030
00031 RCSTAG("@(#)$Id: st_flush.c,v 1.3 2006/07/13 19:16:24 klmitch Exp $");
00032
00041 struct _st_flush_s {
00042 smat_table_t *sf_table;
00043 smat_iter_t sf_flush;
00044 void *sf_extra;
00045 };
00046
00065 static unsigned long
00066 _st_flush_iter(hash_table_t *table, hash_entry_t *ent, void *extra)
00067 {
00068 unsigned long retval = 0;
00069 struct _st_flush_s *sf;
00070
00071 sf = extra;
00072
00073
00074 _st_remove(sf->sf_table, he_value(ent), ST_REM_FIRST | ST_REM_SECOND);
00075
00076
00077 if (sf->sf_flush)
00078 retval = (*sf->sf_flush)(sf->sf_table, he_value(ent), sf->sf_extra);
00079
00080 _smat_free(he_value(ent));
00081
00082 return retval;
00083 }
00084
00085 unsigned long
00086 st_flush(smat_table_t *table, smat_iter_t flush_func, void *extra)
00087 {
00088 struct _st_flush_s sf;
00089
00090 initialize_dbpr_error_table();
00091
00092 if (!st_verify(table))
00093 return DB_ERR_BADARGS;
00094
00095
00096 sf.sf_table = table;
00097 sf.sf_flush = flush_func;
00098 sf.sf_extra = extra;
00099
00100
00101 return ht_flush(&table->st_table, _st_flush_iter, &sf);
00102 }