From: Peter Somogyi Date: Tue, 5 Dec 2006 12:09:48 +0000 (+0100) Subject: Using samba DLIST helper macro set. X-Git-Tag: tevent-0.9.20~348^2~3002^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c21a32c30da9ca1c16597ea3e78f16886f4f1fa;p=thirdparty%2Fsamba.git Using samba DLIST helper macro set. (This used to be ctdb commit 1ed174dd02428748b8273a91c8d0d335795f12c3) --- 9c21a32c30da9ca1c16597ea3e78f16886f4f1fa diff --cc ctdb/ib/ibwrapper.c index 9778b4e0419,9778b4e0419..338afb1096d --- a/ctdb/ib/ibwrapper.c +++ b/ctdb/ib/ibwrapper.c @@@ -37,7 -37,7 +37,7 @@@ #include "lib/events/events.h" #include "ibwrapper_internal.h" -- ++#include "lib/util/dlinklist.h" #define IBW_LASTERR_BUFSIZE 512 static char ibw_lasterr[IBW_LASTERR_BUFSIZE]; @@@ -93,23 -93,23 +93,7 @@@ static int ibw_conn_destruct(void *ptr ctx = ibw_conn->ctx; assert(ctx!=NULL); -- /* unhook conn from ctx's linked list */ -- assert(ctx->first_conn!=NULL); -- assert(ctx->last_conn!=NULL); -- -- if (conn->prev==NULL) { -- assert(ctx->first_conn==conn); -- ctx->first_conn = conn->next; -- } else { -- conn->prev->next = conn->next; -- } -- -- if (conn->next==NULL) { -- assert(ctx->last_conn==conn); -- ctx->last_conn = conn->prev; -- } else { -- conn->next->prev = conn->prev; -- } ++ DLIST_REMOVE(ctx->conn_list, conn); return 0; } @@@ -128,15 -128,15 +112,7 @@@ static ibw_conn *ibw_new_conn(ibw_ctx * conn->ctx = ctx; -- /* append conn to the end of ctx's linked list */ -- conn->prev = ctx->last_conn; -- conn->next = NULL; -- if (ctx->first_conn) { -- assert(ctx->last_conn!=NULL); -- conn->prev->next = conn; -- } else { -- ctx->first_conn = ctx->last_conn = conn; -- } ++ DLIST_ADD(ctx->conn_list, conn); return conn; } diff --cc ctdb/ib/ibwrapper.h index c5ca0272cc9,c5ca0272cc9..6f646a4a08e --- a/ctdb/ib/ibwrapper.h +++ b/ctdb/ib/ibwrapper.h @@@ -38,7 -38,7 +38,7 @@@ typedef struct _ibw_ctx ibw_state_ctx state; void *internal; -- ibw_conn *first_conn, *last_conn; ++ ibw_conn *conn_list; /* 1st elem of double linked list */ } ibw_ctx; typedef enum {