DLIST changes

Andrew Bartlett abartlet at samba.org
Fri Jan 21 21:01:50 MST 2011


On Fri, 2011-01-21 at 10:39 +0000, Sam Liddicott wrote:
> In re-basing my work on alpha15 I'm bitten by some dlist changes.
> 
> I've worked round them, but suggest some changes to DLIST.
> I suggest a change (1) and an additional choice of changes (2).
> 
> For my own code I shall adopt (1) and (2.2) for the time being.
> 
> 
> 1. addition of DLIST_ADD_END with 2 parameters.
> 
> It is fine that the third parameter is ignored, but we can at least 
> avoid requiring it to be specified for new code.

Perhaps the best would be to remove the third argument and it's users?
It is only used in 120 lines of code, and the compiler will show when
the job hasn't been finished. 

> 2. support of void* list-heads.
> 
> I make use of void* private pointers, like 
> smbcli_request.asyc.private_data as list heads.

Can't you just cast them to a list of void* structure, and then put your
other void* elements under that?

ie 

struct list_of_void {
	struct list_of_void *prev, *next;
	void *this_ptr;
}

That would move the list prev and next out of your private structure.  

However, if only your code deals with a list here, does it really need a
void * for the pointer?

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.



More information about the samba-technical mailing list