[ccan] AVR, hashtable and general containers...
Rusty Russell
rusty at rustcorp.com.au
Fri Oct 29 20:45:56 EST 2010
On Fri, 29 Oct 2010 10:47:33 am Thomas Jones wrote:
> On 22/10/10 10:18 PM, Rusty Russell wrote:
> > The accepted wisdom in linked lists in C is to embed rather than dissociate
> > the list element. This avoids allocations and (sometimes) maintains type
> > safety. So let's apply a congruent argument here.
> >
> > If our objects know they are in a container, then we should not only prefer
> > sets to maps, but the AVL struct should be placed into the object. (Linear
> > hash has the advantage that there is no per-object struct).
> I've been wondering why the kernels red-black trees haven't been
> converted to a ccan module (and in fact I was going to do it and
> submit a patch, but I haven't gotten around to it), now more so
> since they are much like what you describe here...
The rbtree half-implementation in the kernel is a horror; assume a modern
compiler which will inline function parameters and it would be much cleaner.
I'd love such a reimplemetation though :)
Thanks!
Rusty.
More information about the ccan
mailing list