On Wed, Aug 02, 2006, EV wrote:
> > This whole section of code is a mess:
> >
> > if (!host) {
> > [print some stuff and exit]
> > }
> > if (host != NULL) { // <- always true, so why test?
> >
> > Should look more like:
> >
> > if (!host) {
> > lk_errors_p(...);
> > usage(0);
> > goto cleanup;
> > }
> > karma = lk_karma_connect(host);
> > lk_errors_p(...);
> > free(host);
> > if (karma < 0)
> > goto cleanup;
> >
> > [do stuff]
> > cleanup:
> > free(blah);
> >
> > Gotos are ugly and all that, but this way you don't miss a
> > free(). I'll work up a patch if no one gets to it first.
>
> Agree. But there lk_is_karma_mountpoint() and
> lk_mountSearch_discover() are a mess too. I think
> lk_is_karma_mountpoint() should only be called from (and should
> be part of) lk_is_karma_mountpoint.c. lk_mountSearch_discover
> is the only one to be called. May be we need to cache the return
> value to prevent repeated attempts if it is to be called many
> timaes...
If I may add my 2 pennies worth...
I think that the entire section should go away. Applications should
not be made aware of the two seperate methods for accessing the karma.
There should be a single lk_karma_connect() call which takes care of
auto-probing the device (if necessary), and connecting.
However, this would require an API change, so it should wait until after
the next release.
Keith.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-karma-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-karma-devel