From ffb17459b3ccb49ae0cfbe5ae2cd8d63a458d5d5 Mon Sep 17 00:00:00 2001 From: jcid Date: Mon, 29 Oct 2007 23:18:25 +0100 Subject: Fixed a subtle bug in klist that was affecting IO. --- src/klist.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/klist.c') diff --git a/src/klist.c b/src/klist.c index 113472b6..b353bb51 100644 --- a/src/klist.c +++ b/src/klist.c @@ -18,6 +18,7 @@ * remains with the caller. */ +#include "msg.h" #include "klist.h" @@ -29,6 +30,14 @@ static int Klist_node_by_key_cmp(const void *Node, const void *key) return ((KlistNode_t *)Node)->Key - VOIDP2INT(key); } +/* + * Compare function for searching data by node + */ +static int Klist_node_by_node_cmp(const void *Node1, const void *Node2) +{ + return ((KlistNode_t *)Node1)->Key - ((KlistNode_t *)Node2)->Key; +} + /* * Return the data pointer for a given Key (or NULL if not found) */ @@ -68,7 +77,7 @@ int a_Klist_insert(Klist_t **Klist, void *Data) Node = dNew(KlistNode_t, 1); Node->Key = (*Klist)->Counter; Node->Data = Data; - dList_insert_sorted((*Klist)->List, Node, Klist_node_by_key_cmp); + dList_insert_sorted((*Klist)->List, Node, Klist_node_by_node_cmp); return (*Klist)->Counter; } -- cgit v1.2.3