On Sat, Dec 12, 2009 at 11:36 PM, David Brownell <davi...@pacbell.net>wrote:

> On Saturday 12 December 2009, Marek Vasut wrote:
> > > Also, can you restructure it so that you don't just add a bit
> > > "if (there's a custom erase_page) { ... }"?  That's the sort
> > > of thing which is easier to just require.
> >
> > Require? Why? No other driver probably needs it/will find it useful.
>
> To streamline and simplify the primary code paths.  It's better to
>
>        ptr->op(...)
>
> than to
>
>        if (ptr->op)
>                ptr->op(...);
>        else
>                inlined default version ptr->op();
>
> Admittedly this is one of the ways the current source is less
> clean than it should be.  But that's not a reason to perpetuate
> such practices.
>

I can't say I disagree with this position.  Maybe as one of my tasks for the
next week, I'll start doing this kind of cleanup in my nand-refactor branch
at http://repo.or.cz/w/openocd/dnglaze.git.  I still have some NAND tweaks
up there that aren't in mainline, but something like this might be worth
including in that work.  It's sort of a NAND cleanup branch anyway.

// Dean Glazeski
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to