1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

Using samba DLIST helper macro set.

(This used to be ctdb commit 1ed174dd02428748b8273a91c8d0d335795f12c3)
This commit is contained in:
Peter Somogyi 2006-12-05 13:09:48 +01:00
commit 9c21a32c30
2 changed files with 4 additions and 28 deletions

View File

@ -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,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 +112,7 @@ static ibw_conn *ibw_new_conn(ibw_ctx *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;
}

View File

@ -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 {