[cvs] bogofilter/src datastore.c,1.73,1.74
David Relson
relson at osagesoftware.com
Wed Mar 23 13:30:51 CET 2005
On Wed, 23 Mar 2005 09:28:40 +0100
Matthias Andree wrote:
> David Relson <relson at users.sourceforge.net> writes:
>
> > @@ -393,7 +393,7 @@
> > /* Cleanup storage allocation */
> > void ds_cleanup(void *dbe)
> > {
> > - if (dsm && dsm->dsm_cleanup)
> > + if (dsm != NULL && dsm->dsm_cleanup)
> > dsm->dsm_cleanup(dbe);
> > xfree(msg_count_tok);
> > xfree(wordlist_version_tok);
>
> OK. Keeping the if dsm->dsm_cleanup here is essential,
> as the SQLite driver doesn't a cleanup function.
>
> My idea was to let the driver only define those functions it really
> offers and let datastore.c ignore others (as a model of virtual
> functions that are only defined if there is support in the back-end,
> think non-pure C++ virtual function model).
>
> The other code (checking if dsm->dsm_begin is defined) was proactively
> added to unify the whole datastore handling across all datastores so
> we'd have a dsm for all datastore drivers - this would allow us to get
> rid of the dummy functions in the long run.
Checking "if (dsm != NULL && dsm->dsm_xyz != NULL)" is ugly. If the
code always sets dsm, then it's just necessary to check
"if (dsm->dsm_xyz != NULL)". That'd be fine.
_______________________________________________
Bogofilter-dev mailing list
Bogofilter-dev at bogofilter.org
http://www.bogofilter.org/mailman/listinfo/bogofilter-dev
More information about the bogofilter-dev
mailing list