Re: [RFC] header cache type "safety" (was: [RFC] header caching for MH)
Hello Rocco,
> -mutt_hcache_fetch_raw (void *db, const char *filename,
> +mutt_hcache_fetch_raw (header_cache_t *db, const char *filename,
> size_t(*keylen) (const char *fn))
> {
> - struct header_cache *h = db;
> #ifndef HAVE_DB4
> char path[_POSIX_PATH_MAX];
> int ksize;
> @@ -669,7 +666,7 @@ #elif HAVE_DB4
> DBT data;
> #endif
>
> - if (!h)
> + if (!db)
> return NULL;
I would prefer if the pointer in the header cache functions stays the
same name "h" and not "db". It would make the diff considerable smaller
and is even easier to read in cases like that:
> - h->db->get(h->db, NULL, &key, &data, 0);
> + db->db->get(db->db, NULL, &key, &data, 0);
If you consider construct like the above.
Except the above I agree with your patch. But someone should test it
with the following scenarios before commiting it:
* qdbm (Linux / Solaris)
* gdbm (Linux / Solaris)
* db4 (Linux / Solaris)
* no hcache at all (Linux / Solaris)
Thanks,
Thomas