
Removing node from linked list
On Mon, 08 May 2000 23:26:14 +1000, Donald Halloran
...
Quote:
>typedef struct ObjListNode {
> OBJECT Object;
> ObjListNode* next;
> ObjListNode* prev;
> } OBJECT_LISTNODE;
The above declaration is not valid C code. If your compiler accepts it,
it's being provided as an extension. You may be using a C++ compiler
instead of a C compiler. In C, you must declare next and prev as
struct ObjListNode *next;
struct ObjListNode *prev;
because a structure tag is not a type name.
...
[rest of code snipped]
Except for the fact that you're not freeing the last node in the list, the
code looks okay to me. I was about to write that the code fails when
Node->next == NULL, but then I saw that you don't remove that last node.
I suspect that whatever is causing the failure is somewhere else in the
program, in code you haven't shown us. I suggest stepping through this part
of the code with a de{*filter*}, if you have one available. Barring that, try
to post a minimal complete program that displays the problem.
--
Kenan Systems Corp., a wholly-owned subsidiary of Lucent Technologies