X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=cache.c;fp=cache.c;h=9180570b9b63eac0d3fb2c9bdd60b3733d65b951;hb=f0f4bb0c37eeed71934e3191cffa5afb1cfdca0d;hp=6a0a874da433fdb4ff43ad962606356141f743fe;hpb=7bb43bd370e70385a4ccde06f3f4554f488aa6b3;p=catta diff --git a/cache.c b/cache.c index 6a0a874..9180570 100644 --- a/cache.c +++ b/cache.c @@ -147,3 +147,26 @@ void flx_cache_drop_record(flxCache *c, flxRecord *r) { if ((e = flx_cache_lookup_record(c, r))) remove_entry(c, e, TRUE); } + +static void func(gpointer key, gpointer data, gpointer userdata) { + flxCacheEntry *e = data; + flxKey *k = key; + + gchar *s, *t; + + s = flx_key_to_string(k); + t = flx_record_to_string(e->record); + + fprintf((FILE*) userdata, "%s %s\n", s, t); + + g_free(s); + g_free(t); +} + +void flx_cache_dump(flxCache *c, FILE *f) { + g_assert(c); + g_assert(f); + + fprintf(f, ";;; CACHE DUMP FOLLOWS ;;;\n"); + g_hash_table_foreach(c->hash_table, func, f); +}