files.c and ubiqx

Andrew Tridgell tridge at samba.anu.edu.au
Mon Aug 17 16:00:24 GMT 1998


> typdef struct
>   {
>   ubi_dlNode      node;
>   struct whatever data;
>   } descendant_type;
> 
> descendant_type *MyNode;
> 
> You can skip the macros and pass a pointer to the node directly to the API
> functions.  Above, you would pass &(MyNode->node) to ubi_dlInsert() or
> ubi_dlRemove(), and never use the macros.

well, that would assume that &(MyNode->node) == MyNode. I know this
will be the case for all reasonable systems, but it isn't something I
love :)

> You would have to do this kind of thing for every descendant type, but the
> overhead should be much less than re-implementing a linked list each time. 

As you may have noted, what I did instead is implemented it all as a
couple of macros in dlinklist.h. This gives full type checking while
avoiding recoding. Only possible because linked lists are so simple :)

	 Cheers, Andrew


More information about the samba-technical mailing list