initial gencache implementation
tpot at samba.org
Fri Sep 6 00:18:00 GMT 2002
On Thu, Sep 05, 2002 at 12:15:36PM +0200, Rafal Szczesniak wrote:
> This is first implementation of caching mechanism. It includes
> both lib/gencache.c code and utils/net_cache.c as command-line
> control/testing tool.
> comments are welcome
Rafal, that looks pretty good. Since you ask, I do have a few comments.
You assume that any cached data will be in null terminated string format
which is not always the case.
This is just my personal opinion but I would prefer for gencache_set to
crash if you pass it a NULL pointer for the key or value parameter.
Returning false in this case only hides the error until further along
in the execution path by which time it will be more difficult to track
down the original error.
Some other minor things:
- memleak of cache_fname in gencache_init
- memleak of keybuf.dptr in gencache_set
I don't think you need to strdup the key before passing it to tdb_fetch
in gencache_set. You can just use the passed in parameter.
More information about the samba-technical